Forum

> > CS2D > Scripts > Clientdata
Forums overviewCS2D overview Scripts overviewLog in to reply

English Clientdata

9 replies
To the start Previous 1 Next To the start

old Clientdata

Promaster
User Off Offline

Quote
I think i found a bug of Clientdata. When i use client data mode 2 (checking mouse position over the map in pixels) with a screensize of 850x480, it works fine and it gives me correct coordinations over where my mouse is pointing at on the map. However when i use fullscreen, i got a coordination that are not matching where my mouse is pointing at.

and here is my question, is this a bug from cs2d? Can anyone check that out with fullscreen and normal screen (850x480)

ps: Mode 1 (checking mouse position of the screen) works fine, but mode 2 is maybe bugged

old Re: Clientdata

DC
Admin Off Offline

Quote
Are you using cs2d cmd mp_hudscale (any mode > 0)?
Mode 1 of cs2d lua cmd reqcld is designed to work with mp_hudescale, mode 2 however is NOT designed to work with mp_hudscale.

Unfortunately all this scaling stuff is a complicated/tricky topic. It wasn't possible to automatically make this specific mode fully compatible with the new resolution for all cases.

If you are using cs2d cmd mp_hudscale > 0 AND are drawing HUD elements at the position you get from cs2d lua hook clientdata mode 2 you will have to do manual script adjustments.

If you however are using the position from cs2d lua hook clientdata mode 2 to do things on the map directly, it will work fine without further adjustments. No matter which cs2d cmd mp_hudscale you use.

old Re: Clientdata

Promaster
User Off Offline

Quote
So in other words, you have no plan to fix this issue? Because it is impossible for me to fix the coordination for players who plays with fullscreen or normal resolution. And the standard coordination error is depending on the rotation

old Re: Clientdata

DC
Admin Off Offline

Quote
It's not a bug - that's what I tried to explain in my previous post. So no, it won't be fixed. But I might introduce a new mode for cs2d lua cmd reqcld to handle this case.

At the moment you either have to scale/position stuff manually (you can get the resolution of a player with cs2d lua cmd player) or you can combine cs2d cmd reqcld 0 and 1 to get the cursor position + the map scrolling offset (it's a bit complicated because you have to cache values since it's asynchronous stuff.

Sorry for the bad news. Unfortunately not all scripts can work out of the box with the new resolution stuff.

old Re: Clientdata

Promaster
User Off Offline

Quote
I solved this by finding the standard error. Thank you DC for you took your time

old Re: Clientdata

Mora
User Off Offline

Quote
nah. If i have mode 2 and 850x480(windowed) is working fine, but with 1280x720(full) it does not. That should be fixed.

old Re: Clientdata

DC
Admin Off Offline

Quote
@user Mora: *sigh*
again: There are two use cases for mode 2. One should always work, one doesn't work right with custom resolutions. I can't make both work at the same time.

√ working: when you use the coordinates to do stuff on the map. like clicking tiles or other objects on the map

× not working: when you use the coordinates to render HUD text / images.

So it's not exactly a bug. It's a choice. For use case one.

old Re: Clientdata

Promaster
User Off Offline

Quote
Nevermind, my calculation of x and y depending of the players resolution was sooo wrong!

Please DC, can you help me with a correct calculation of X and Y depending on a players resolution?

In the beginning, it worked fine, but now it went banana

IMG:https://image.prntscr.com/image/ec1b88fe81b140678c44851c5d98971f.png


1
2
3
4
if mode == 2 then
		x = math.floor(x-((player(id, "screenw")-850)/2)
		y = math.floor(y-((player(id, "screenh")-480)/2)
		blocksize = ((((player(id, "screenw")/850)*32)+((player(id, "screenh")/480)*32))/2)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview