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

Ask for help

Moderators: Murderator+, Murderator

Post Reply
paulinho4life
Posts: 45
Joined: 2004-07-20 00:14:10

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

Post 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
Edred
Expert!
Posts: 2544
Joined: 2004-04-03 17:36:29
Location: Saint-Petersburg

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

Post 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 ;)
Chameleon
Posts: 4
Joined: 2004-08-09 14:17:33

Post 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
Lord Ruslan Nightmare
Expert!
Posts: 359
Joined: 2004-04-25 11:11:07
Contact:

Post by Lord Ruslan Nightmare »

labels sux. Any real programmer will tell you this.
Без труда не выловишь и рыбку из пруда,
А без пруда не выловишь её и с трудом...
ruff
Posts: 46
Joined: 2004-06-26 15:36:11
Location: Praha

Post by ruff »

definitly
paulinho4life
Posts: 45
Joined: 2004-07-20 00:14:10

ty

Post by paulinho4life »

ty
Post Reply