← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #262893]: Gaming Bot

 

Question #262893 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/262893

    Status: Open => Answered

RaiMan proposed the following answer:
Usually this are either timing problems (the screen does not yet contain
what you expect or has already changed, so it does no longer contain
what you expect) or you are using "bad images" in a scenario with a
varying background or where your images might be seen on a varying
background.

The problems can be "debugged" by using the response mode in FindFailed situations:
at the beginning of the script say:
setFindFailedResponse(PROMPT)

if then a FindFailed happens in your workflow, then a popup with the image will come, and you can check the screen, maybe rearrange it and then say retry or abort (skip usually does not help, if your script is not prepared for that).
If you found the cause, repair your script and try again.

-- timing problems
do not use absolute waits (wait(n)) before searching, instead wait for the image and then use it:
instead of
wait(3)
hover("rhSelect-1.png")

use
hover(wait("rhSelect-1.png", 10))

a high timeout value does no harm, since in the moment the image
appears, the wait is ended and the mouse will be moved to the match in
this case.

So in general to make your workflow more robust, wait for images
explicitly at least at critical spots in your workflow.

-- bad images
people tend to make shots, that contain too much of the background towards the edges, which caused by the internally used technique, might lead to false positives or FindFailed situations.
When making shots, try to get as little background as possible around the inner parts of the image, that really makes it unique in the search region used at runtime. 
This is vital in situations (most often in games), where a visual might appear on varying backgrounds.

Generally for both robustness and speed: use restricted search regions instead of always searching the whole screen.
There are many features in Sikuli, that allow to set a region relative to a match already found (a title, a button, some fixed graphic element, ...).

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.