← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #205893]: Sikuli error in script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
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.

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