Re: [Sikuli-driver] [Question #698118]: my script reacts too slow when detecting the image, how to improve it?

2021-07-23 Thread RaiMan
Question #698118 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/698118

RaiMan proposed the following answer:
if nothing else is said, images are searched on the whole screen.
The search would be faster, if you restrict the region as much as possible to 
the area, where you expect the image to appear.

On large screens in most cases it is enough to restrict to the app window:
searchArea = App.focusedWindow()

now you might define additional search areas relative to the (x,y) of your 
primary area
see: 
https://sikulix-2014.readthedocs.io/en/latest/region.html#extend-regions-and-create-new-regions-based-on-existing-regions

I do not understand, why you click 4 times using the image:
if exists(fishButton):
for x in range(4):
click (fishButton)

my variant:
click(wait(fishButton))

or for more control:
if exists(fishButton):
click() # clicks on the last match

now a region, where you expect things to happen:
reg = ... # somehow define it

if reg.exists(fishAppear, 2 * 60):
reg.click(getFish) # see comment

comment: this should work, since if nothing else is said, the search
repeats for 3 seconds.

Another aspect to look at: Settings.WaitScanRate
This 3 in the standard, meaning 3 searches per second max, which normally is 
sufficient.

In special cases, when you have small search areas, where a search might take 
only some 10 milli secs you might raise this value to a higher value (e.g. 10 
means max 10 searches per second, which only makes sense, if searches ar faster 
then 100 milli secs).
Higher values don't do any harm, but only have an effect, if the search times 
fit.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #698118]: my script reacts too slow when detecting the image, how to improve it?

2021-07-23 Thread Manfred Hampl
Question #698118 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/698118

Status: Open => Answered

Manfred Hampl proposed the following answer:
see e.g. https://answers.launchpad.net/sikuli/+question/663281

make search region as small as possible around the place where you
expect the image to appear.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #698118]: my script reacts too slow when detecting the image, how to improve it?

2021-07-22 Thread tony
Question #698118 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/698118

Description changed to:
I am making a script that make my character do the fishing automatically
fishButton = "fishingrod.png"
fishAppear = "exclamationMark.png"
getFish = Pattern("pullBackFishRod.png").targetOffset(2,0) 
Settings.MoveMouseDelay = 0

# this three lines will click on the fishButton to drop the fish road to the sea
if exists(fishButton):
for x in range(4): 
click (fishButton)

# after the fish rod drop to the sea, I wait for the fish to get hooked, when 
the fish get hooked, there will be an exclamation mark show up for about 1 
second. 
# so I wait for the fishAppear image to show up
wait(fishAppear, 2 * 60)
if exists(fishAppear):
for y in range(4):
click(getFish)

the problem now is: the getFish button only show up for like 1 second after the 
fish get hooked.
When the script detects fishAppear, then it take some time to click on the 
getFish button, which the getFish button  already disappeared.

How can I make the script faster but so it can search the fishAppear image 
faster?
Thanks!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp