Moving bar pickup

Asked by Jakob on 2018-01-13

So for most of the day I've been attempting to set up a code that would pickup a pixel pattern and press space bar.

So far I've:

if exists(picture1) or exists(picture2):

The string will pick up and work occasionally but on 2/3 of the time it'll either click early or late.
Any recommendations?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
15 hours ago
masuo (masuo-ohara) said : #1

if you want to confirm these images exist without wait time, set waiting time zero.

if exists(picture1,0) or exists(picture2,0):

Jakob (jakobpk) said : #2

Setting times to 0 helped with the fighting aspect and I thank you, atm my code is this:

        if Region(785,569,352,31).exists("1516053159102.png",0):
                if Region(785,569,352,31).exists("1516053159102.png",0):

While adding more if statements seems to help the same issue occurs regardless, it seems as if the screen flickers the wrong info to trick the program into activating late or early, is there any way I can set an exposure time kind of thing?

masuo (masuo-ohara) said : #3

Did you measure turnaround time of each exists() function?
You should understand the phenomenon before thinking about countermeasures.

If you want to repeat the exact same search, use while or for statement.
r = Region(785,569,352,31)
while True:
    if r.exists("1516053159102.png",0):

And if you don't read basic behavior, this is helpful for your understanding.

TestMechanic (ndinev) said : #4

Here is some ideas worth exploring:
-- what is the timing between appearance and actions you are looking for. Is this in range of seconds or ms?
-- UI focus. Sikuli will type keys against currently focused element of the active window. In my practice I observed many cases where in transition between screens/actions the focus can temporarily be lost. Investigate this possibility.
-- executing aggresive image finding commands will load your cpu and may impact behaviour of your app

Hope this helps

Can you help with this problem?

Provide an answer of your own, or ask Jakob for more information if necessary.

To post a message you must log in.