← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #678616]: onAppear running script when object is not there

 

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

Blake Martin gave more information on the question:
Ok I have changed the script to include the observe commands after doing
some further reading and I still cannot get it to stop running the
command even though the image is not present in the region

Settings.MoveMouseDelay = .1
priceList=Region(373,673,389,39)

purchased=Region(406,714,354,29)
buyr=Region(455,730,314,62)
buyx=Region(724,685,38,53)
torn=Region(132,51,270,142)
nomore=Region(375,280,121,720)
refresh=Region(70,45,34,32)
checkout = Region(683,674,76,35)
bought = Region(502,685,115,57)
bank = Region(262,205,33,29)
manage = Region(376,728,139,39)
income = Region(384,773,132,41)
dropdown = Region(389,814,360,167)
nomoney = Region(416,714,291,33)
withdrawmoney = Region(451,798,56,34)
withdraw = Region(655,795,95,37)
back = Region(8,46,28,30)
windows = Region(0,1038,50,42)
eyballcart = Region(688,651,72,353)

class bankbank:
    def bank2(self):
        wait(1)
        Settings.MoveMouseDelay = .4
        nomoney.onAppear(Pattern("do not have enough money.png").similar(0.39))
        bank.doubleClick("bank icon.png")
        wait(1)
        manage.onAppear("manage companies.png")
        income.click("income chart1.png")
        dropdown.hover("income chart2.png")
        wheel(1 , 8)
        dropdown.click("funds.png")
        wheel(1 , 2)
        withdrawmoney.click("blank area.png")
        type("100k")
        withdraw.click("1550383489075.png")
        back.click()
bankbank
function1=bankbank()

class buybuy:    
    def buy(self): 
          if priceList.exists("eyeballa1.png"):
              priceList.click("buybuycart.png")
          else: 
              wait(1)
           
            
            
buybuy
function2=buybuy()
class purchased123:    
    def tolate(self):
            function3.refreshpage()
        
purchased123
function4=purchased123()
        

class refresh2:    
    def refreshpage(self): 
        
        refresh.click("1550423687127.png")
        wait(4)

refresh2
function3=refresh2()


while windows.exists("windows.png"):
    purchased.observe(FOREVER)
    nomoney.observe(FOREVER)
    
    eyballcart.onAppear("cart.png", function2.buy())
    
    
    purchased.onAppear("1550352686924-1.png", function3.refreshpage())    
    
    nomoney.onAppear(Pattern("do not have enough money.png").similar(0.90), function1.bank2())

    purchased.onAppear("1550433752827.png", function3.refreshpage())
    
    popup("onAppear buy functioin complete")
    
    eyballcart.onVanish("cart.png", function3.refreshpage())
    
    popup("page refreshed")
    
    observe(FOREVER)

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