View Full Version : Floating Point Bug

01-25-2005, 05:00 PM
I know in newfeatures you said you fixed something to do with the floating point so it works with the Kingdoms item sorting.
Now, in any script any zeros directly trailing the decimal point are removed.
For example:
if (created||timeout) {
if (keydown(0)) val += 0.005;
elseif (keydown(2)) val -= 0.005;
setplayerprop #c,#v(val);
timeout = 0.05;

Place this in a level script and tap up or down. You will notice that when there should be zeros trailing the decimal place, they aren't there.

Values in 0.05 increments that I am using in scripts now have small glitches or jumps when the movement of the object should otherwise be smooth.
I'd say this is a rather big problem for the new client.

01-26-2005, 06:05 AM
Ouch, that's no good. Fix it for my buddy Delph! :)

We've got a PW to make ;)

01-26-2005, 06:10 AM
I didn't understand what you were saying at first, but I totally get what you mean

if you open the debugger you see the script is interpreted as
if (keydown(0)) {
val = val+(0.5);
else if (keydown(2)) {
val = val-(0.5);

seems very wrong....

online, clientside, my results were even stranger

from 0 to 1, it only added in 0.05 increments, but after 1 it added in 0.005 increments

01-26-2005, 07:38 AM
In simple terms, it removes any zeros between the decimal place and the next number higher than 0.

0.005 becomes 0.5
13.00008 becomes 13.8

01-26-2005, 11:45 AM
Yep, I found this out to, it ****ed up some Era systems. I had to change the timeout with the var...

01-27-2005, 01:46 AM
Fill fix it, end of the week, sorry x-x

01-29-2005, 03:45 PM
Fixed, download v2.31

02-08-2005, 08:31 PM
Stefan, there are still issues with this. An NPC with this script:

showtext 0,10,10,courier new,,0.01 is converted to: #v(test);
changeimgvis 0,4;

will display the text "0.01 is converted to: 0.1". I'm working from v2.3.1 of the standalone editor, not sure if it also occurs in the online client.

02-08-2005, 10:03 PM
not sure if it also occurs in the online client.
It works fine online.

02-08-2005, 11:03 PM
It works fine online.

Huh, I guess the editor wasn't fully updated.

02-09-2005, 02:14 AM
Huh, I guess the editor wasn't fully updated.

Hmmm the editor says version 2.31 too (if you right click)? weird

02-09-2005, 03:26 AM
Yes it's just the editor. As soon as I got access to an NPC Server online, the problem was gone.

02-09-2005, 03:47 AM
Hmmm the editor says version 2.31 too (if you right click)?

Yep. That was the first thing I checked.

02-09-2005, 10:29 PM
Ok new version uploaded (v2.311) for the editor, it should work correctly now.