[Help]this script cause lag why

Ask for help

Moderators: Murderator+, Murderator

Post Reply
khitans
Posts: 4
Joined: 2007-11-25 22:31:17

[Help]this script cause lag why

Post 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
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post 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.
Destruction
Junior Expert
Posts: 3221
Joined: 2004-06-24 22:08:56

Post 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 ;)
YokoInjection CodeSweeper
Function not found?
Possession of mathematics at the level of art - a gift that is only available for election.
Sorry for my clumsy English.
Telegram: @tatikom
Post Reply