SOLVED variable_global_set with decimals

Andymakeer

Member
Hey guys!

I have a ds_map that have pairs of var_name & var_value, that I send to a method that uses the function variable_global_set to add the value to that variable by its name.

Its working fine, the problems is, seems like variable_global_set rounds the var_value value, so if I send like "1.25" it just adds "1" and so on.

My ds_map is really, really big, so to prevent a giant switch statement, I made the method above.

Help? I read the docs but no luck...
 

Ricardo

Member
I just tried:
GML:
variable_global_set("test",1.25);
show_debug_message(variable_global_get("test"));
And it is printing 1.25 in both GMS 2.2 and 2.3. Are you sure the value is not being rounded somewhere else?
 

GMWolf

aka fel666
Could you post the code you are using?
Could you also print out the value at each step: before putting it in the map, after reading it from the map, before setting it to a global variable and after reading it from the global variable to track down just where the rounding occurs?

If it is indeed a bug with variable_global_set then you should file a bug report.
 

Andymakeer

Member
Are you sure the value is not being rounded somewhere else?
Could you post the code you are using?
Could you also print out the value at each step: before putting it in the map, after reading it from the map, before setting it to a global variable and after reading it from the global variable to track down just where the rounding occurs?
If it is indeed a bug with variable_global_set then you should file a bug report.
ermmmm nevermind, I was just adding the var_value pair to ds_map as a string, not as a real.

my bad, thanks šŸ˜…
 
Top