i noticed a thing and i can't explain why is it..
i have this script:
sub test()
WHILE UO.Life > 0
poison = UO.Poisoned()
IF poison == 1
UO.Cast('Cure','self)
ELSE
wait(5000)
ENDIF
WEND
end sub
In the case of poison different from 1( wait(5000) it doesn't matter if i set 100, 200 or 10000), my client go slowly.. as lag..
if i'm poisoned i go perfectly
if i change in this i move perfectly always:
sub test()
WHILE UO.Life > 0
poison = UO.Poisoned()
IF poison == 1
UO.Cast('Cure','self)
ENDIF
wait(5000)
WEND
end sub
IF Question
Moderators: Murderator+, Murderator
this is a very very often happends logics mistake
note then script
is equivalent to
Empty cylce will consume all CPU.
for any script you think may produce empty cycle it is safe and reliable to add wait(50) command before second operator bracket (wend, next, until, goto)
for instance your script may look like:
note then script
Code: Select all
while ...
if <false> then
....
end if
wend
is equivalent to
Code: Select all
while ...
wend
Empty cylce will consume all CPU.
for any script you think may produce empty cycle it is safe and reliable to add wait(50) command before second operator bracket (wend, next, until, goto)
for instance your script may look like:
Code: Select all
sub test()
WHILE UO.Life > 0
poison = UO.Poisoned()
IF poison == 1
UO.Cast('Cure','self)
ELSE
wait(5000)
ENDIF
wait(50) ### !
WEND
end sub
If you are uncertain whhat happens in your script, do some debug messages... it'll show ya the problem.
btw: what the heck is IF without THEN ? Parser should Yell about it!
btw2: what is "poison=" ment to be, when there is no "var poison" before? HA :)
btw3: it is ABSOLUTELY useless, you can write "IF UO.Poisoned() THEN" instead
Code: Select all
sub test()
WHILE UO.Life > 0
poison = UO.Poisoned()
IF poison == 1
UO.print("TRUE, casting")
UO.Cast('Cure','self)
ELSE
UO.print("FALSE, waiting")
wait(5000)
ENDIF
wait(1000) ### just to slow down all the script and avoid message flood.
WEND
end sub
btw: what the heck is IF without THEN ? Parser should Yell about it!
btw2: what is "poison=" ment to be, when there is no "var poison" before? HA :)
btw3: it is ABSOLUTELY useless, you can write "IF UO.Poisoned() THEN" instead