Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Floating Point Bug (https://forums.graalonline.com/forums/showthread.php?t=57308)

Arkan1k 01-25-2005 05:00 PM

Floating Point Bug
 
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:
NPC Code:
if (created||timeout) {
disabledefmovement;
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.

Curt1zzle 01-26-2005 06:05 AM

Ouch, that's no good. Fix it for my buddy Delph! :)

We've got a PW to make ;)

Evil_Trunks 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
PHP Code:

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

Arkan1k 01-26-2005 07:38 AM

In simple terms, it removes any zeros between the decimal place and the next number higher than 0.

e.g.
0.005 becomes 0.5
13.00008 becomes 13.8

Snakeandy7 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...

Admins 01-27-2005 01:46 AM

Fill fix it, end of the week, sorry x-x

Admins 01-29-2005 03:45 PM

Fixed, download v2.31

Kaimetsu 02-08-2005 08:31 PM

Stefan, there are still issues with this. An NPC with this script:

NPC Code:

if(playerenters){
test=0.01;
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.

CheeToS2 02-08-2005 10:03 PM

Quote:

Originally Posted by Kaimetsu
not sure if it also occurs in the online client.

It works fine online.

Kaimetsu 02-08-2005 11:03 PM

Quote:

Originally Posted by CheeToS2
It works fine online.

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

Admins 02-09-2005 02:14 AM

Quote:

Originally Posted by Kaimetsu
Huh, I guess the editor wasn't fully updated.

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

Arkan1k 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.

Kaimetsu 02-09-2005 03:47 AM

Quote:

Originally Posted by Stefan
Hmmm the editor says version 2.31 too (if you right click)?

Yep. That was the first thing I checked.

Admins 02-09-2005 10:29 PM

Ok new version uploaded (v2.311) for the editor, it should work correctly now.


All times are GMT +2. The time now is 09:25 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.