View Full Version : Client strings

02-26-2005, 07:36 PM
I have noticed that with the new scripting engine enabled, it is not possible to have a client. or clientr. string that is equal to "0".
For example, "clientr.mp=0" in Attributes will simply remove "clientr.mp" from the list of client strings, making it hard for some GUI scripts to show the correct information.
I think this is probably because the new engine returns a non-existent string as 0.
Could this be fixed?

02-26-2005, 07:39 PM
Could you do clientr.mp = "0" making the value a character rather than an integer?

02-26-2005, 07:45 PM
No, that does the same thing. :confused:

02-26-2005, 10:22 PM
PLEASE change this

we don't like it either on Classic

right now our gui does something like this

showtext x,y,,,#v(strtofloat(#s(clientr.bombs)));

02-27-2005, 04:21 AM
Yes you need to use strtofloat if you want to make sure it is a number, there is no way to avoid that. It is really needed for compatibility with old Graal script:

set varname; -> translated into varname = true; -> varname = 1;
unset varname; -> translated into varname = false; -> varname = 0; -> var is removed

In old Graal script the if (varname) command is just checking if the variable is existing, not if the value is non-zero. So to make unset work correctly it needs to remove the variable. This is also very nice for removing data that is not needed anymore, just set it to zero or empty string for removing it.