ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: dxrom on July 05, 2011, 10:53:25 AM

Title: algorithms
Post 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%...

Code: [Select]
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?
Title: Re: algorithms
Post by: Cerveza on July 05, 2011, 11:14:22 AM
EUO doesn't play with decimals very nicely. Better to just adjust everything up a couple of places.
Title: Re: algorithms
Post by: dxrom on July 05, 2011, 11:19:23 AM
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.
Title: Re: algorithms
Post by: Cerveza on July 05, 2011, 11:24:10 AM
Wouldn't you want to do it this way?

( #maxStam * %stamPercMod ) / 100

153 * 40 = 6120 / 100 = 61.2
Title: Re: algorithms
Post by: dxrom on July 05, 2011, 11:27:18 AM
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
Title: Re: algorithms
Post by: dxrom on July 05, 2011, 11:31:10 AM
Your solution worked, Cerveza!
...but why? -.-
Thank you :)
Title: Re: algorithms
Post by: Cerveza on July 05, 2011, 11:39:39 AM
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
Title: Re: algorithms
Post by: dxrom on July 05, 2011, 11:44:36 AM
BUT! ...but!
Same exact output regardless of the algorithm used, however for mine it... i don't understand... -.-
euo is stupid somtimes.
Title: Re: algorithms
Post by: UOMaddog on July 05, 2011, 12:10:28 PM
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!
Title: Re: algorithms
Post by: dxrom on July 05, 2011, 12:21:39 PM
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.
Title: Re: algorithms
Post by: Thimotty on July 05, 2011, 01:58:42 PM
Since swing is calculated at exact stamina values (30,60,90....) static value is better