← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #283780]: how to change default screen to a custom region?

 

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

    Status: Answered => Open

Kopanda is still having a problem:
I have a working program that is searching and finding patterns on the
whole screen, it does it's job great, BUT sometimes, very rarely, it
finds matches outside the game window, so i want to restrict the search
to region.

To do that i first define a region by typing:
r = 

after then i press "region button" on the toolbar, program asks me to
select a region. I select it, program pastes a mini picture of that
region after equals sign in the expression, that means i defined a
region and stored it into "r" variable, is that correct? If thats not
how the tool works - please correct me.

So if i did everything correct - i just defined a region.

Next i take my almost perfectly working code that is ONLY using "exists"
functions to find patterns on the screen, (no other function is looking
for patterns on the screen in my code), so then i add "r." in front of
every single "exists" function in my code.

If i understand correctly - now Sikuli should look for those patterns
not on the entire screen, but only in region that i stored in "r"
variable. If that is correct - after that my program should stop finding
patterns and clicking outside the region that i stored in "r" variable,
but it doesnt - it still finds matches outside the region that i stored
in "r" variable and i dont understand why.

Either "exists" function ignores region that it was called by and always
searches the entire screen, OR the IDE tool that i marked with an arrow
on my screenshot works not as i expect it to work.

In any case i could try and define region differently (for example like
you said, but using this method will be problemmatic, since i might want
to move the game window and i will need to get coordinates and type them
in code again every time, while using UI tool is super easy) and i could
replace all "exists" functions with "click" functions and ignore all the
"pattern not found" errors, but i really want to understand why my code
doesnt work, thats almost as important for me to understand what im
doing wrong as to fix the code.

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