← Back to team overview

sikuli-driver team mailing list archive

[Question #659555]: Dealing with Multiple onAppear images using background observe and region

 

New question #659555 on Sikuli:
https://answers.launchpad.net/sikuli/+question/659555

Settings.MoveMouseDelay = 0.05
def Battle(evt):
    InAction = True
    print("Found Battle Button")
    click("1508195786538.png")
    wait("1508195823256.png", FOREVER); click();wait(1)
    HoverForMove()
    evt.repeat()
    
def NextButton(evt):
    InAction = True
    print("Found Next Button")
    click("1508200678194.png");wait(1)
    HoverForMove()
    evt.repeat()

def MapNext(evt):
    InAction = True
    click(Pattern("1508200450289.png").similar(0.80));wait(1)
    HoverForMove()
    evt.repeat()

def EndGame(evt):
    running = False

def HoverForMove():
    print("Hovering Search")
    hover(Pattern("1507123087352-1.png").targetOffset(-217,-356));wait(1)
    InAction = False
    
reg = Region(560,0,560,1050)    
reg.onAppear("1508195786538.png",Battle)
reg.onAppear(Pattern("1508200450289.png").similar(0.80),MapNext)
reg.onAppear("1508200678194.png",NextButton)
reg.onAppear(Pattern("1507126043448-1.png").similar(0.96).targetOffset(-12,92),EndGame)
reg.observe(FOREVER,True)

print("Starting Loop")
running = True
InAction = False
HoverForMove()
while (running):
    if(not InAction):
        mouseDown(Button.LEFT)
        mouseUp(Button.LEFT)
    wait(.33)
exit
===============================================================================
The problem is it only registers the first reg.onAppear which references a battle button
===============================================================================
reg = Region(560,0,560,1050)    
reg.onAppear("1508195786538.png",Battle)
reg = Region(560,0,560,1050) 
reg.onAppear(Pattern("1508200450289.png").similar(0.80),MapNext)
reg = Region(560,0,560,1050) 
reg.onAppear("1508200678194.png",NextButton)
reg = Region(560,0,560,1050) 
reg.onAppear(Pattern("1507126043448-1.png").similar(0.96).targetOffset(-12,92),EndGame)
reg = Region(560,0,560,1050) 
reg.observe(FOREVER,True)

also does not work

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