ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: dxrom on July 05, 2011, 10:53:25 AM
-
So I want this script to use divine fury when my stamina is less then 40%...
set stamPercMod 40
set stamPerc ( ( #MAXSTAM / 100 ) * %stamPercMod )
if #STAMINA < %stamPerc
gosub dFury
sub dFury
event macro 15 205
wait 5
return
I have 153 stamina, and following that algorithm, %stamPerc should be set to 61.2, so it should use divine fury at around 61 stamina, however instead it does it at 40 stamina. Is this an integer issue?
-
EUO doesn't play with decimals very nicely. Better to just adjust everything up a couple of places.
-
Is there any way I can have the output read as REAL, so it reads the number without the decimal?
I mean, I could adjust it to work with my stats and come out without a decimal, but then I would have to do that with every chr I play on that I use this with, and anyone who uses it would have to do the same thing.
-
Wouldn't you want to do it this way?
( #maxStam * %stamPercMod ) / 100
153 * 40 = 6120 / 100 = 61.2
-
Wouldn't you want to do it this way?
( #maxStam * %stamPercMod ) / 100
153 * 40 = 6120 / 100 = 61.2
It comes out the same though.
153 / 100 = 1.53 * 40 = 61.2
-
Your solution worked, Cerveza!
...but why? -.-
Thank you :)
-
The .2 is probably being ignored, and your not calculating in decimals doing it this way. EUO doesn't work well with decimals, oh I mentioned that :P
-
BUT! ...but!
Same exact output regardless of the algorithm used, however for mine it... i don't understand... -.-
euo is stupid somtimes.
-
Here's what happened:
In your method you do:
153/100 = 1.53
Since EUO doesn't like decimals, it sees 1
You then do:
1* 40 = 40
TADA! You have your result (As EUO sees it)
In Cerv's method, you do:
153*40 = 6120 (No decimals, so EUO likes it and sees 6120)
You then do:
6120/100=61.2 (EUO doesn't like decimals so it sees 61)
TADA! You have your result! (As EUO sees it)
Order of Operations is merely a vaguely followed idea that is not well manifested in EUO! LOL!
-
This makes sense...
w00t, thank you guys!
This was something I was workin on for my sampire assistant script (LAME). I figured that instead of having it dfury at a static amount of stamina, percent base would be better.
-
Since swing is calculated at exact stamina values (30,60,90....) static value is better