How to loop this script forever?

Ask for help

Moderators: Murderator+, Murderator

Post Reply
utternoob
Posts: 24
Joined: 2007-11-17 12:39:26

How to loop this script forever?

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

Re: How to loop this script forever?

Post 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
utternoob
Posts: 24
Joined: 2007-11-17 12:39:26

Post by utternoob »

nothing changes, it will stop if i have more than 500 bandages.

what does "return false" command mean?
Edred
Expert!
Posts: 2544
Joined: 2004-04-03 17:36:29
Location: Saint-Petersburg

Post 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
Last edited by Edred on 2008-02-27 23:31:42, edited 1 time in total.
Ни один скрипт не работает? Пора обновить Инжект...
Все работает, но хочется большего? Пора переходить на стелс...
Destruction
Junior Expert
Posts: 3221
Joined: 2004-06-24 22:08:56

Post by Destruction »

Эээ, шо за бред пишем?

учимсо закрывать ифы.. Дать сцылку на урок? :roll:
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
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

Я тут писал, ошыбся :))
utternoob
Posts: 24
Joined: 2007-11-17 12:39:26

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

Post by Edred »

Destruction
Потерял при копировании, спасибо. Поправил код...
Ни один скрипт не работает? Пора обновить Инжект...
Все работает, но хочется большего? Пора переходить на стелс...
Post Reply