Page 1 of 1

[Help]this script cause lag why

Posted: 2008-01-27 22:06:38
by khitans
I would like to know how get this script does not cause lag

Code: Select all

sub hpoison()
     while NOT UO.Dead()
   repeat
            if UO.Poisoned()==1 then
                  wait(700)
                  uo.exec("cast 'Cure' self")
            end if
            if uo.poisoned()==0 then
                  if UO.Life < UO.str then
                        UO.bandageself()
                        wait(4000)
                  endif
      until UO.Life == UO.str
if UO.Life <= 30 then
uo.usetype('0x0E24')
wend
end sub

Posted: 2008-01-27 22:12:05
by Nmy
Well firstly you should use code/code when you post a script.

You need to use wait somewhere, because it can madly cycle without delay's and do nothing.

Posted: 2008-01-27 22:33:42
by Destruction
Your script is clumsy.

For example, unexpected "until UO.Life == UO.str", expected "endif" and unexpected "wend", expected "endif"..

Two unclosed operators.. :)

And as Mr Nmy wrote, u must use some pause in cycles (for, while, repeat).

PS: Correct version:

Code: Select all

sub hpoison()
   while NOT UO.Dead()
      repeat
         if UO.Poisoned()==1 then
            wait(700)
            uo.exec("cast 'Cure' self")
         end if
         if uo.poisoned()==0 then
            if UO.Life < UO.str then
               UO.bandageself()
               wait(4000)
            endif
         endif ; !!! NEW LINE !!!
         wait( 100 ) ; !!! NEW LINE !!!
      until UO.Life == UO.str
      if UO.Life <= 30 then
         uo.usetype('0x0E24')
      endif ; !!! NEW LINE !!!
   wend
end sub


I was add comment to new lines in script. Don't forget to close IF in next times ;)