Page 1 of 1

How to loop this script forever?

Posted: 2008-02-27 19:49:11
by utternoob
hello,

i want to loop this script forever-> viewtopic.php?p=71971#71971
script forever but it stops if i have more than 500 bandages. i just want it to loop and check if i have more 500 bandages, if i have less it should take 500 bandages from my bank and continue. help please :)[/url]

Re: How to loop this script forever?

Posted: 2008-02-27 20:13:32
by Nmy
utternoob wrote:hello,

i want to loop this script forever-> viewtopic.php?p=71971#71971
script forever but it stops if i have more than 500 bandages. i just want it to loop and check if i have more 500 bandages, if i have less it should take 500 bandages from my bank and continue. help please :)[/url]


Code: Select all

sub getBandagesFromBank()
while 1
   var bandages = "0x0000" ; graphical type of bandages
   if uo.count( bandages ) < 500 then
   uo.findtype( bandages, "-1", uo.objAtLayer( "Bank" ) )
   if not uo.findcount() then
      uo.print( "Bandages was not found in bankbox." )
      return false
   endif
   uo.moveitem( "finditem", "500" )
   uo.print( "Bandages was be moved." )
   endif
 wait(5000)
wend
endsub

Posted: 2008-02-27 20:17:38
by utternoob
nothing changes, it will stop if i have more than 500 bandages.

what does "return false" command mean?

Posted: 2008-02-27 21:40:56
by Edred

Code: Select all

while  
   var bandages = "0x0000" ; graphical type of bandages


Mr Nmy, а перед sub начало цикла втыкать не пробовал?

utternoob
Try it:

Code: Select all

sub getBandagesFromBank() 
   var bandages = "0x0000" ; graphical type of bandages
   while NOT UO.Dead()
      if uo.count( bandages ) < 500 then
           uo.findtype( bandages, "-1", uo.objAtLayer( "Bank" ) )
           if not uo.findcount() then
              uo.print( "Bandages was not found in bankbox." )
              return
           endif
           uo.moveitem( "finditem", "500" )
           uo.print( "Bandages was be moved." )
      endif
      wait(5000)
   wend
endsub

Posted: 2008-02-27 21:59:10
by Destruction
Эээ, шо за бред пишем?

учимсо закрывать ифы.. Дать сцылку на урок? :roll:

Posted: 2008-02-27 22:13:14
by Nmy
Я тут писал, ошыбся :))

Posted: 2008-02-27 22:13:57
by utternoob
thanks all, now its working how i wanted it to work :D

thats all i needed

Code: Select all

sub getBandagesFromBank2()
   while NOT UO.Dead()
      if uo.count('bandage') < 100 then
           uo.findtype('bandage', "-1", uo.objAtLayer( "Bank" ) )
      endif
      uo.moveitem( "finditem", "100")
      wait(5000)
   wend
endsub

Posted: 2008-02-27 23:32:52
by Edred
Destruction
Потерял при копировании, спасибо. Поправил код...