Page 1 of 1

Why when i put 2 ifs in the same script, my uo starts to lag

Posted: 2004-08-10 18:03:19
by paulinho4life
Why when i put 2 ifs, in the same script,
my uo starts to get slower? And when i load 3 scripts, all of them with 2 ifs, i cant play, because i have little crashs all the time...

E.G

sub Bandages()
while true
if uo.life <= 90 then
if uo.mana >= 50 then
uo.exec ("bandageself")
wait (2000)
else
wait (1500)
end if
end if
wend
end sub

Re: Why when i put 2 ifs in the same script, my uo starts to

Posted: 2004-08-10 19:59:02
by Edred
paulinho4life wrote:Why when i put 2 ifs, in the same script,
my uo starts to get slower? And when i load 3 scripts, all of them with 2 ifs, i cant play, because i have little crashs all the time...

E.G

sub Bandages()
while true
if uo.life <= 90 then
if uo.mana >= 50 then
uo.exec ("bandageself")
wait (2000)
else
wait (1500)
end if
end if
wend
end sub


You have empty cycle (no actions) if your health greater 90. Scripts with empty cycle is simple way to lags and full busy your processor. Insert wait(100) to end of your script (before 'wend') and enjoy ;)

Posted: 2004-08-11 15:35:34
by Chameleon
another way you could do it is

Code: Select all

sub Bandages() 
while true
if uo.life <= 90 AND uo.mana >= 50 then
uo.exec ("bandageself")
wait (2000)
else
wait (1500)
end if
wend
end sub

just a suggestion :)
or not use the while command and set a label(thats how I set my infinite loops)

Code: Select all

sub Bandages() 
top:
if uo.life <= 90 then
if uo.mana >= 50 then
uo.exec ("bandageself")
wait (2000)
else
wait (1500)
end if
goto top
end sub

hrmm actually that'd still lag :P Edred has the right of it

Posted: 2004-08-11 16:19:20
by Lord Ruslan Nightmare
labels sux. Any real programmer will tell you this.

Posted: 2004-08-12 19:02:04
by ruff
definitly

ty

Posted: 2004-08-17 16:50:35
by paulinho4life
ty