sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #12547
Re: [Question #205876]: Sikuli fight script works slow
Question #205876 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/205876
Status: Open => Answered
RaiMan proposed the following answer:
LOL (sorry ;-), I really waited on that question :-)
... since it is clear: it is a game bot and they must be as fast as possible.
--1: All your searches are on the whole screen.
This means, that every search can take up to 1 sec depending on your machine.
Restrict the searches to regions, where you expect the target to be and your search time could be decreased to 1/10
--2. you use exists() very often
If it does not find, then it only gives up after the standard 3 seconds waiting time (which makes sense in normal workflows, where you click something and wait for the next image to appear).
So in cases, where you only want to know if something is there or not (this is why we have exists), simply use
exists(image, 0)
and it will do only one search and come back immediately if not found.
Due to a bug, if search fails it returns earliest after 0.3 seconds, even if the search was done in some milliseconds.
If you want to squeeze this:
Settings.WaitScanRate = 10
which makes it to return earliest after 0.1 seconds, which should be sufficient
--3: mouse movement
the mouse movement is animated and every mouse move takes 0.5 seconds (standard).
If you do not want that:
Settings.MoveMouseDelay = 0
--4: use what you already found (did not check, wether it applies in your case)
many people script this
wait("some-button.png", 10)
click("some-button.png")
this adds another search for the same visual object with the click, so this is better:
wait("some-button.png", 10)
click(getLastmatch())
which simply clicks the match, that was found with the wait before and might save you 1 second.
Last but not least:
Just scanning the docs and the faqs, might give you the one or other hint, what is possible and how to do it efficiently.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.