exists(image) is true even when the image is not there yet

Asked by Miyamoto on 2018-05-08

Good morning.

I am developing a game bot with infinite loop with many if's conditions, it's almost done, the main problem is one of the if exists(image) is getting true when the image is not there.

example:

while (ch.hasWindow() & running):
....
            if exists(image1):
                do something
                break

            if exists(image2):
                do another thing
                break:

            if exists(image3):
            ....
                img = find(image3)
                click(img)
            ....
...

The if exists(image3): is the last if inside while loop, but it's getting true even when the image is not there yet.

[error] script [ arrayDeMonstros ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\SikuliX\arrayDeMonstros.sikuli\arrayDeMonstros.py", line 43, in <module> hero = find(heroMax) Line 2782, in file Region.java
at org.sikuli.script.Region.wait(Region.java:2782)
at org.sikuli.script.Region.find(Region.java:2329)
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
org.sikuli.script.FindFailed: FindFailed: 1524942610020.png: (822x628) seen at (46, 128) with 0,94 in S(0)[0,0 1920x1080] E:Y, T:3,0 Line 2782, in file Region.java

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Miyamoto
Solved:
2018-05-09
Last query:
2018-05-09
Last reply:
2018-05-08
Manfred Hampl (m-hampl) said : #1

Do you have

            if (image1):

or

            if exists(image1):

in your script?

Miyamoto (musashibr) said : #2

Sorry, fixed , it's "if exists(image1):" in all if's

Miyamoto (musashibr) said : #3

Problem solved.

After searching better, I setup a specific region where those messages appears and increased the pattern.

Miyamoto (musashibr) said : #4

Not pattern, similar