Sikuli error in script

Asked by Wiw3K kisu

Sup its me again lol xD Python lang is strange for me ... Thanks RainMan for helping me out :D
So i have another problem ... no idea why Sikuli still wants to go click some image even if i have 123123 checks before ... Why ?

pt.FindFailed: FindFailed: can not find Pattern("Nr.png").similar(0.88).targetOffset(10,-10) on the screen.
 Line 115, in file C:\DOCUME~1\Fabio\USTAWI~1\Temp\sikuli-tmp7567307921242192079.py

ok error is simple and i understand it but why this line of code is executed O.o

check comment in script

Script:
http://pastebin.com/c7ba9C5a

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Wiw3K kisu
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

This is the snippet where you think it happens:

def changeMap(hMapCheck, checkFight):
        if hGUIRegion.exists(hCheck2,0) and checkFight == 0:
            toFight = 1
        else:
            if hGUIRegion.exists(hMap1,0) and checkFight == 0:
                hMapRegion.click(Map1to2) #how the hell he get there O.o ... there throws error

Though in your listing it is line 103 and the error reports line 115! Sure the source is the same as what you are running?

--- how the hell he get there O.o
easy to answer:
-- because somewhere in your script changeMap is called with some value for parameter hMapCheck and second parameter 0
-- and -- because hCheck2 is not found on the screen at that time
-- and -- hMap1 is found on the screen at that time (at least something, that matches with a score > 0.88)
-- and -- checkFight is 0 at that time

so I guess hell does not know at all and cannot help ;-)

But Region.highlight() might help:

def changeMap(hMapCheck, checkFight):
        if hGUIRegion.exists(hCheck2,0) and checkFight == 0:
            toFight = 1
        else:
            if hGUIRegion.exists(hMap1,0) and checkFight == 0:
                hGUIRegion.getLastMatch().highlight(3)
                hMapRegion.click(Map1to2) #how the hell he get there O.o ... there throws error

So you can see at least 3 secs before crash, what the hell might have been found ;-)
and in the message area you get a printout of the match.

Revision history for this message
Wiw3K kisu (kisu1337) said :
#2

You know what, i found Your answer in other topic about Global Variables, it was about to do Settings.mySetting
And this worked for me :) Anyways thanks for reply :D Next time ill search a bit before reply :)