← Back to team overview

sikuli-driver team mailing list archive

[Question #689076]: Logical looping for speed

 

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


My script looks through the defined region for 18 unique "targets" that move around very fast.
My previous method was to lump all the pictures together and using if reg.exists() + reg.getLastMatch()
I feel like it is way too slow. So I wanted to group the targets and loop for them in sections.

What I have:

mmd = Settings.MoveMouseDelay = 0
Settings.ObserveScanRate = 9

##Region stuff

...

##Grouping
group1=False
group2=False
group3=False

while 1:
     if reg_range.exists("Target1.PNG", 0) or reg_range.exists("Target2.PNG", 0):
         group1 = True
         group2 =  False
         group3 = False
         if reg_cast.exists("ActionButton.png", 0):
            click(reg_range.getLastMatch())
     if not group1:
         if reg_range.exists(""Target3.PNG", 0) or reg_range.exists("Target4.PNG", 0):
             group2 = True
             group1 =  False
             group3 = False
             if reg_cast.exists("ActionButton.png", 0):
                 click(reg_range.getLastMatch())
     if not group2:
         if reg_range.exists("Target5.PNG", 0)  or reg_range.exists("Target6.PNG", 0):
             group3 = True
             group1 =  False
             group2 = False
             if reg_cast.exists("ActionButton.png", 0):
                 click(reg_range.getLastMatch())
##etc...



The targets can appear all together or random clusters and random intervals. I would like the script to loop until one of the targets appears then stop looping to find the other targets, click on the target it identified. I would like it to do all of that repeatedly until I stop running the script.

I cannot tell if there is any difference in speed between this method and my previous method...

Is my approach appropriate for what I'm describing? 


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