How to wait for visual object to come up and be sure it is the right one?

Asked by dill pole

So I have been attempting to make a script for the past 7 hours, and it hasn't been going to well, so I decided to get some help.
I play a private game and it quite often puts a Macro check up, very simple questions such as 1+1=2 or 1+2=2 with answers of Yes or No.
So far what i have is

wait(img, timeout=600000)
click(img, modifiers=0)

I put the timeout to 600000 because the macro check comes up with different questions so it could be 20-30 minutes before I get the right image I have waiting for. The click would either be for yes or no for the questions.
I got it to execute well but it doesn't do a proper match, for eg if the image I have is 1+1=2 and 2+1=3 pops up it will say it has been found and solves it with a wrong answer I have selected for. I don't know how to use the whole exact() thing in my codes yet(im not that good :P) but I heard similar(0.99) finds matches better. Can someone help me out?

P.S sorry RaiMan for emailing you, my computer was being a bit iffy so I couldn't make an account to post a question, sorry a bunch.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

For the looping thing: look my recent answer at https://answers.launchpad.net/sikuli/+question/149688

your similarity problem:

That is tricky, especially with text involved.

I would first try to find out, wether the popup comes up at all: if the region where it pops up is constant, you might use an observer with onChange().

Then try to analyze the contents (e.g. using Region.text() if possible)

If you like, you can send me some relevant screenshots and you trial script altogether zipped to my known mail address.

Revision history for this message
dill pole (dpolusny) said :
#2

I have sent you emails, thanks alot man.

Can you help with this problem?

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

To post a message you must log in.