← Back to team overview

sikuli-driver team mailing list archive

[Question #661213]: How to shorten time with tons of exists() if-statments

 

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

Hi, i am playing a game and unlocking toons from time to time, when i had 10 before, my code was working fine. but now i have 30+ toons, some of them take almost 5-10 mins to start choosing their task. my code is as follows:

        if tasktitle.exists(Icon1):     
            # 6 mins task
            CharacterIndex = Toon1  # Toon1 = 1
        elif tasktitle.exists(Icon2):      
            # 6 mins task
            CharacterIndex = Toon2  # Toon2 = 2, etc...
        elif tasktitle.exists(Icon3): 
            # 8 min task
            CharacterIndex = Toon3   
        ....
        elif tasktitle.exists(Icon99): 
            # 8 min task
            CharacterIndex = Toon99   

i read the manual and i tried Settings.ObserveScanRate can be changed but not quite helpful
For example,
        Settings.ObserveScanRate = 0.01

        if tasktitle.exists(Icon1):     
            # 6 mins task
            CharacterIndex = Toon1  
        elif tasktitle.exists(Icon2):    
            ........  

        Settings.ObserveScanRate = 1

Some toons still take age to start choosing their task.
Any idea how i can improve my situation?
Maybe you can advise some scenario to achieve my goal since i am not expert in programming.




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