← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #200354]: findAll function is not returning any results though match preview indicates it should

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- the reported error

there is something strange with the line numbering:
--- you say: the findAll() in line 14
--- error says: line 15, in if x == y: 

but then the findAll() should be in line 16 !?

and then an error is reported with line 30 (FindFailed with
1339174675949-1.png) - so which image is it in this case?

If it is the image that variable Found references, then I would change
the code not using with, since I guess this puts the error to the last
line.

          m = Large.findAll(Found)
          while m.hasNext():
                  x = m.next()
                  y = x #resetting the value of y
                  click(x)
                  print(x,y)

--- avoiding false positives on find
you should use:
x = Large.find(Pattern(Found).similar(0.99)) #finding the first searchable in level

to make sure, the exact pattern is found.

this normally helps to make sure not to click on false positives.

BTW: One can use Region.getLastMatch(), to not search for something, that was already found before.
your code:

while Large.exists(Found): #searching for hit boxes
        x = Large.getLastMatch() #current new position

But with the Pattern().similar(0.99) (DO NOT use 1.0 !) you might solve
your problem anyway.

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