← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #284587]: looping a script forever in Sikulix

 

Question #284587 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/284587

Description changed to:
First of all apologies for asking a question that already exists and
answered numerous times but my knowledge of python is 0 i am a ultra
noob and i dont understand any of those explanations.

I made a macro for a game with Sikulix and it works fine i just need to
loop it forever i need the code that will enable this for my macro.

This is the code i need looped

click("1453202630435.png")
wait(80)
wait("1453736008362.png",10),click("1453736008362.png")
wait("1453202801705.png",25),click("1453202812250.png")
wait(10)
Image1 = ("1453723117924-4.png")
Image2 = ("1453735625632.png")
class Multi():
    def __init__(self):
        self.Search()
    def Search(self):
        # Look when one of the two images appear. 
        while True: 
            print('Searching....')
            if exists("1453723117924-5.png"):
                print("1453723117924-6.png")
                click("1453723117924-7.png")
                # Break loop.
                break
            elif exists("1453735625632.png"):
                print("1453735625632.png")
                click("1453735625632.png")
                # Break loop.
                break
            else:
                pass
# Run class 
Multi()
wait("1453202882292.png",20),click("1453202898972.png")

Im sure its crude and can be refined but im happy with it like a childs
first drawing or something i just need the loop code added to this so i
can see it and copy it, explaining it wont help as im too dumb at the
moment to understand i am trying to learn basic python but will be a
while before im able to understand any of it any help much appreciated.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.