ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Kryz on August 22, 2015, 09:17:46 PM
-
Im looking for a quick way to use a range in an expression.
IE if A = B +-1
If A is equal to B, B+1, B-1
Am I stuck with If A = B || A = B + 1 || A = B - 1 Or is there a quicker way to do it?
-
If you do a little bit of algebra, you can simplify what you're looking for:
set %a 6
set %b 5
set %c 1 ; range
if ( abs ( %a - %b ) <= %c )
{
display ok within range
}
stop
-
set %A 1
set %B 2
set %Range 1
If abs( %A - %b ) <= %Range
Display ITS IN RANGE
Display its not in Range
-
Tm beat me by seconds!
-
Tm beat me by seconds!
Nearly exact same code! Great minds DO think alike! :)
-
Thank you all!
-
You two are just so cute.
I would do it one step further and make a sub routine.
gosub InRange 6 5 1
if #result
display ok It's in range!
else
display ok come a little closer baby.
halt
sub InRange
if abs ( %1 - %2 ) <= % 3
return #true
return #false