← Back to team overview

sikuli-driver team mailing list archive

[Question #168610]: Loop script, tried but can't understand it

 

New question #168610 on Sikuli:
https://answers.launchpad.net/sikuli/+question/168610

Really sorry but i am having a hard time understanding the information i have been given and looked up about looping sikuli scripts

i am a bit slow and have trouble understanding theory.....

I have tried many scripts about looping and nothing is working for me.....

All i wish to do is loop my script that works very well... and i tried to add the stuffs so that if this image exsits it'll brake the loop and stop, then else  continue.

So what i wanted to do is stop when see's image, otherwise continue..... below is the script i manage to do and wanted it done with.

# This makes sure your in Space Base
click( )
wait(2)

# This refuels your fleet
click( )
wait(2)
click( )
wait(2)
click( )
wait(2)
click( )
wait(2)

# This starts your Instances
click( )
wait(2)
click( )
wait(2)
click( )#Instance Lvl
wait(2)
click( )
wait(2)
click( )#Fleet1
wait(1)
click( )#Fleet2
wait(1)
click( )#Fleet3
wait(1)
click( )#Fleet4
wait(1)
click( )#Fleet5
wait(1)
click( )#Fleet6
wait(2)
click( )
wait(2)
click( )
wait( , FOREVER)
click( )

#This will sort Instances mail and box
click( )
wait(2)
click( )
wait(2)
click( )
wait(2)
click( )
wait(2)
click( )
wait(3)

I have tried stuff like:

# --- this loops forever
while True:
   if not exists( , 0):
      break # but ends if img gets visible
      popup("UNDER ATTACK!!!")
   else:
      pass # we will see
   wait(5) # check every 5 seconds
print  , "finally came up"

But it would not loop, could someone please help me out and add to the script in the way it needs to be to make it loop non stop and brake when it see the right image..... I have been at it for 12hrs, yet i still not managed to get it to loop...

Any help on this would be greatly thanked.....

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.