New question #188721 on Sikuli: https://answers.launchpad.net/sikuli/+question/188721
iron = Pattern("1330030896672.png").similar(0.74) iron2 = Pattern("1329980545422.png").similar(0.89) copper = Pattern("nA.png").similar(0.91) copper2 = Pattern("1329980670115.png").similar(0.89) bronze = Pattern("1330030708790.png").similar(0.90) bronze2 = Pattern("1330030666167.png").similar(0.95) gamezone = Region(0,19,1280,750) myself = ""L.png"" waittime = 10 mineiron = True minecopper = True minebronze = True minetin = True global lastroom global currentroom global noore def mine9_m23)(): global lastroom global currentroom global noore if gamezone.exists(Pattern("Q.png").similar(0.87), 0): currentroom = 1 gamezone.click("1330056004176-1.png", 0) lastroom = 1 wait (2) if gamezone.exists(Pattern("1330057093507.png").similar(0.88), 0): currentroom = 2 if lastroom == 1: gamezone.click(Pattern("1330056261522.png").similar(0.83), 0) lastroom = 2 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("Fr.png").similar(0.83), 0): currentroom = 3 if lastroom == 2: gamezone.click("1330056367548.png", 0) lastroom = 3 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("1330057294326.png").similar(0.87), 0): currentroom = 4 if lastroom == 3: gamezone.click("1330056435973.png", 0) lastroom = 4 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("Fr.png").similar(0.83), 0): currentroom = 5 if lastroom == 4: gamezone.click("1330056367548.png", 0) lastroom = 5 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("1330057093507.png").similar(0.88), 0): currentroom = 6 if lastroom == 5: gamezone.click(Pattern("1330056261522.png").similar(0.83), 0) lastroom = 6 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("Q.png").similar(0.87), 0): currentroom = 1 if lastroom == 6: gamezone.click("1330056004176-1.png", 0) def fightover(): if gamezone.exists(Pattern("Close-2.png").similar(0.86), 0): gamezone.click(Pattern("Close-2.png").similar(0.86), 0) wait(2) else: pass def fight(): #Fight module while gamezone.exists(Pattern("1330033988160.png").similar(0.76), 0): if gamezone.exists("IIFr.png", 0): if gamezone.exists(Pattern("1330034086473.png").similar(0.78), 0): gamezone.click(Pattern("1330034086473.png").similar(0.78), 0) gamezone.click("IIFr.png", 0) wait(1) else: if gamezone.exists(myself, 0): type(skill1) #hotkey for skill to kill resource protector. gamezone.hover(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20)) #Hover over the protector so we can see if it possible target it. if gamezone.exists(Pattern("1326907907791.png").similar(0.67), 0): # if we see this image while hoverin target that mean we cant target.: type(skill2) #now lets try another skill with longer range or skill that doesnt need line of sight. gamezone.hover(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20)) # hover over protector again and lets see if we can target it. if gamezone.exists(Pattern("1326907907791.png").similar(0.67), 0): #Still not range or vision to target. type(skill3) if gamezone.exists("1330034753277.png", 0): #(resim degisti) gamezone.click("1330034753277.png", 0) #(resim degisti) wait(0.5) gamezone.click("1330034845030.png", 0) #lets skip turn and wait protector come closer. (resim degisti) else: pass else: if gamezone.exists(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0): gamezone.click(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0) #click ptotector with skill in hotkey 1 wait(1) fightover() wait(2) pass else: #if we have vison and not seeing that not allowed image we gona do targeting. if gamezone.exists(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0): gamezone.click(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0) #click ptotector with skill in hotkey 3 wait(1) fightover() wait(1) pass #(bunun altindaki bikac satir silindi) def levelup(): if gamezone.exists(Pattern("1326218415060-1.png").similar(0.84), 0): #Level up gamezone.click(Pattern("1326218415060-2.png").similar(0.84), 0) #Close level up window else: pass def letsmine(): #Mining module global noore if mineiron == True: if gamezone.exists(iron): noore = 0 gamezone. click(iron, 0) wait(waittime) levelup() if mineiron == True: if gamezone.exists(iron2): noore = 0 gamezone.click(iron2, 0) wait(waittime) levelup() #COPPER if minecopper == True: if gamezone.exists(copper): noore = 0 gamezone.click(copper, 0) wait(waittime) levelup() if minecopper == True: if gamezone.exists(copper2): noore = 0 gamezone.click(copper2, 0) levelup() wait(waittime) #BRONZE if minebronze == True: if gamezone.exists(bronze): noore = 0 gamezone.click(bronze, 0) wait(waittime) levelup() if minebronze == True: if gamezone.exists(bronze2): noore = 0 gamezone.click(bronze2, 0) wait(waittime) levelup() else: noore = 1 pass while gamezone.exists("1330043783741.png",0): #while this image on screen it keep looping this.(resim degisti/ne oldugunu bilmiyorum?) letsmine() #Start mining module fight() #run fight module if gamezone.exists(Pattern("Close-2.png").similar(0.86), 0): fightover() else: if noore == 1: mine9_m23() pass ------------------------------------------------------------------ This is a game script kind of mining bot, when i press ready it doesn't work and at the bottom i typed the errors [error] Stopped [error] Error message: IndentationError: ('unindent does not match any outer indentation level', ('C:\\Users\\Sansar\\AppData\\Local\\Temp\\sikuli-tmp6068196268132607402.py', 84, 3, ' gamezone.click("1330056004176-1.png", 0)\n')) --------------------------------------------------------------------- basicly what i am trying to do is; First of all, this is a java game and there are specific picture colors. it should collect iron, copper, bronze etc. in each room then when there is no mine picture on wall it should jump to anothermap then again should collect iron,copper,bronze etc. then jump other map again... then jump next again then go back to the last room then go back last room when i come back first room i need to repeat the actions over again... sometimes when u collect mines monsters attack or you levelup to avoid error there are extra scripts inside please help me to fix this 1280 x 800 pixel screen ----------------------------------------------------------------------------- the original one was this, but i couldn't try i have no idea if the original works or not, when i tried to run it in random map it didn't, and i am not allow to go to the same map... :D ------------------------- #Ore images iron = Pattern("1328354492386.png").similar(0.85) iron2 = Pattern("1328354540035.png").similar(0.92) copper = Pattern("1326996379899.png").similar(0.92) copper2 = Pattern("1327504102432.png").similar(0.91) bronze = Pattern("1327598128947.png").similar(0.86) bronze2 = Pattern("1327598613957.png").similar(0.88) cobalt = Pattern("Wa.png").similar(0.84) cobalt2 =Pattern("1326736544373.png").similar(0.90) manganese = Pattern("1328354406260.png").similar(0.92) manganese2 = Pattern("1328354337114.png").similar(0.92) tin =Pattern("1326650739979.png").similar(0.76) tin2 =Pattern("1326735605254.png").similar(0.72) silver = Pattern("1326735806117.png").similar(0.76) silver2 =Pattern("1326735806117.png").similar(0.74) bauxite = Pattern("nl.png").similar(0.76) bauxite2 =Pattern("1326736319688.png").similar(0.68) gold = Pattern("1326735129778.png").similar(0.72) gold2 =Pattern("1326735902198.png").similar(0.69) #REGIONS: These help script work faster. gamezone = Region(319,23,1277,854) ui = Region(849,898,750,142) tooltipui = Region(313,448,83,130) okbutton = Region(887,571,141,43) closebutton = Region(837,737,241,42) coordinate = Region(329,60,87,22) #SETUP myself = Pattern("mlI.png").similar(0.56) #Image of yourself from target user interface. Take picture when it your turn and let that orange bar fill little bit. waittime = 10 #this set time between mining skill1 = "3" #Choose skill 1 to kill protector. (Hotkey) skill2 = "1" #Choose skill 2 to kill protector. (Hotkey) skill3 = "7" #This one it will target on ground i use living chest. (Hotkey) damageGear = "v" #hotkey for damage gear. If you arent carrying another gear with use same hotkey on both. miningGear = "b" #hotkey for mining gear. If you arent carrying another gear with use same hotkey on both. #Also check line 519 to select right mine. Current i have only make room changer to two mines. More coming later or you can make own ones. #Select minable ores True= mine False= dont mine mineiron = True #IRON require level 1 minecopper = True #COPPER requires level 10 minebronze = True #BRONZE requires level 20 minecobalt = True #COBALT requires level 30 minemanganese = True #MANGANESE requires level 40 minetin = True #TIN requires level 50 minesilver = False #SILVER requires level 60 minebauxite = False #BAUXITE requires level 70 minegold = False #GOLD requires level 80 #VARIABLES global lastroom #Variable using moving to right room. Dont edit global currentroom #Variable using moving to right room. Dont edit global noore #Variable using moving to right room. Dont edit def mine5_19(): #Room swap module global lastroom global currentroom global noore if gamezone.exists(Pattern("YlllIALx.png").similar(0.87).targetOffset(491,-217), 0): currentroom = 1 gamezone.click(Pattern("YlllIALx.png").similar(0.87).targetOffset(491,-217), 0) lastroom = 1 if gamezone.exists(Pattern("LL2FkT.png").similar(0.85).targetOffset(58,194), 0): currentroom = 2 if lastroom == 1: gamezone.click(Pattern("LL2FkT.png").similar(0.85).targetOffset(58,194), 0) lastroom = 2 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("RT1.png").similar(0.90).targetOffset(-225,239), 0): currentroom = 3 if lastroom == 2: gamezone.click(Pattern("RT1.png").similar(0.90).targetOffset(-225,239), 0) lastroom = 3 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("YLLJl4IOknAk.png").similar(0.92).targetOffset(19,171), 0): currentroom = 4 if lastroom == 3: gamezone.click(Pattern("YLLJl4IOknAk.png").similar(0.92).targetOffset(19,171), 0) lastroom = 4 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("RT1.png").similar(0.90).targetOffset(417,151), 0): currentroom = 5 if lastroom == 4: gamezone.click(Pattern("RT1.png").similar(0.90).targetOffset(417,151), 0) lastroom = 5 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("1327506293863.png").similar(0.93).targetOffset(274,-80), 0): currentroom = 6 if lastroom == 5: gamezone.click(Pattern("1327506293863.png").similar(0.93).targetOffset(274,-80), 0) lastroom = 6 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("s4Iil1ijQ.png").similar(0.89).targetOffset(16,139), 0): currentroom = 7 if lastroom == 6: gamezone.click(Pattern("s4Iil1ijQ.png").similar(0.89).targetOffset(16,139), 0) lastroom = 7 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("2L1.png").similar(0.89).targetOffset(-203,-9), 0): currentroom = 8 if lastroom == 7: gamezone.click(Pattern("2L1.png").similar(0.89).targetOffset(-203,-9), 0) lastroom = 8 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("RT1.png").similar(0.87).targetOffset(-81,-145), 0): currentroom = 9 if lastroom == 8: gamezone.click(Pattern("RT1.png").similar(0.87).targetOffset(-81,-145), 0) lastroom = 9 wait (2) else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("LL2FkT.png").similar(0.92).targetOffset(-921,188), 0): currentroom = 10 if lastroom == 9: gamezone.click(Pattern("LL2FkT.png").similar(0.92).targetOffset(-921,188), 0) lastroom = 10 else: if currentroom == lastroom: lastroom = lastroom - 1 if gamezone.exists(Pattern("YlllIALx.png").similar(0.93).targetOffset(491,-217), 0): currentroom = 1 if lastroom == 10: gamezone.click(Pattern("YlllIALx.png").similar(0.93).targetOffset(491,-217), 0) def mine22_22(): #Room swap module global lastroom global currentroom global noore if coordinate.exists(Pattern("2222.png").similar(0.87), 0): currentroom = 1 gamezone.click(Pattern("Vi.png").similar(0.89).targetOffset(-3,-39), 0) lastroom = 1 if coordinate.exists(Pattern("2223.png").similar(0.89), 0): currentroom = 2 if lastroom == 1: gamezone.click(Pattern("g_F.png").similar(0.89).targetOffset(22,-37), 0) lastroom = 2 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2224-1.png").similar(0.88), 0): currentroom = 3 if lastroom == 2: gamezone.click(Pattern("Lv4AZ-1.png").similar(0.91).targetOffset(-25,-20), 0) lastroom = 3 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2225.png").similar(0.89), 0): currentroom = 4 if lastroom == 3: gamezone.click(Pattern("E.png").similar(0.90).targetOffset(-35,-7), 0) lastroom = 4 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2226.png").similar(0.89), 0): currentroom = 5 if lastroom == 4: gamezone.click(Pattern("m4MEilIu.png").similar(0.90).targetOffset(21,136), 0) lastroom = 5 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2225.png").similar(0.89), 0): currentroom = 6 if lastroom == 5: gamezone.click(Pattern("IQI.png").similar(0.87).targetOffset(-28,120), 0) lastroom = 6 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2224.png").similar(0.88), 0): currentroom = 7 if lastroom == 6: gamezone.click(Pattern("Y-2.png").similar(0.88).targetOffset(-21,119), 0) lastroom = 7 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2324.png").similar(0.88), 0): currentroom = 8 if lastroom == 7: gamezone.click(Pattern("uq.png").similar(0.86).targetOffset(-25,127), 0) lastroom = 8 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2424.png").similar(0.88), 0): currentroom = 9 if lastroom == 8: gamezone.click(Pattern("IJ1IFJXnatLi.png").similar(0.90).targetOffset(-9,125), 0) lastroom = 9 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2524.png").similar(0.89), 0): currentroom = 10 if lastroom == 9: gamezone.click(Pattern("Y-1.png").similar(0.93).targetOffset(21,-23), 0) lastroom = 10 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2424.png").similar(0.88), 0): currentroom = 11 if lastroom == 10: gamezone.click(Pattern("1327735688324.png").similar(0.89).targetOffset(22,-10), 0) lastroom = 11 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2324.png").similar(0.88), 0): currentroom = 12 if lastroom == 11: gamezone.click(Pattern("B1.png").similar(0.90).targetOffset(4,-19), 0) lastroom = 12 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2224.png").similar(0.88), 0): currentroom = 13 if lastroom == 12: gamezone.click(Pattern("YBrakmarIII.png").similar(0.84).targetOffset(-29,128), 0) lastroom = 13 else: if currentroom == lastroom: lastroom = lastroom - 1 if coordinate.exists(Pattern("2223.png").similar(0.89), 0): currentroom = 14 if lastroom == 13: gamezone.click(Pattern("4IFI.png").similar(0.87).targetOffset(-18,144), 0) lastroom = 14 else: if currentroom == lastroom: lastroom = lastroom - 1 def fightover(): if closebutton.exists(Pattern("Close.png").similar(0.89), 0): closebutton.click(Pattern("Close.png").similar(0.89), 0) #close window after fights. wait(2) #wait 2 sec after figt over screen is closed type(miningGear) #Rquip mining gear. else: pass def fight(): #Fight module while ui.exists(Pattern("in.png").similar(0.95), 0): #while this image is on screen we keep looping this fight module. if ui.exists(Pattern("WIEEFZ-1.png").similar(0.72), 0): # If ready button exists -> type(damageGear) # Equip Damage gear. Optional. wait(1) #Lets wait 1 sec to get gear on. if ui.exists(Pattern("1326896184818.png").similar(0.53), 0): #find tactical mode button ui.click(Pattern("1326896184818.png").similar(0.53), 0) #Enable tactical mode. ui.click(Pattern("WIEEFZ-1.png").similar(0.66), 0) #click ready button wait(1) else: # if ready button dont exists that mean we are not in fight or we are allready clicked it. if gamezone.exists(myself, 0): #When picture with arrow about yourself in target user interface is found mean its our turn. type(skill1) #hotkey for skill to kill resource protector. gamezone.hover(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20)) #Hover over the protector so we can see if it possible target it. if gamezone.exists(Pattern("1326907907791.png").similar(0.67), 0): # if we see this image while hoverin target that mean we cant target.: type(skill2) #now lets try another skill with longer range or skill that doesnt need line of sight. gamezone.hover(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20)) # hover over protector again and lets see if we can target it. if gamezone.exists(Pattern("1326907907791.png").similar(0.67), 0): #Still not range or vision to target. type(skill3) if gamezone.exists(Pattern("V.png").similar(0.92), 0): gamezone.click(Pattern("V.png").similar(0.92), 0) wait(0.5) ui.click(Pattern("Y.png").similar(0.64), 0) #lets skip turn and wait protector come closer. else: pass else: if gamezone.exists(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0): gamezone.click(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0) #click ptotector with skill in hotkey 1 wait(1) fightover() wait(2) pass else: #if we have vison and not seeing that not allowed image we gona do targeting. if gamezone.exists(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0): gamezone.click(Pattern("1327510524930.png").similar(0.76).targetOffset(0,20), 0) #click ptotector with skill in hotkey 3 wait(1) fightover() wait(1) pass def toolcheck(): #This will check if you have mining pick on hand. if tooltipui.exists(Pattern("W.png").similar(0.77), 0): #if this picture appear on screen it will equip your mining gear. type(miningGear) #Hotkey for mining gear noore = 1 click(Pattern("1327738617111.png").similar(0.93).targetOffset(18,-15), 0) else: pass def levelup(): if okbutton.exists(Pattern("1326218415060-1.png").similar(0.84), 0): #Level up okbutton.click(Pattern("1326218415060-2.png").similar(0.84), 0) #Close level up window else: pass def letsmine(): #Mining module global noore if mineiron == True: if gamezone.exists(iron): noore = 0 gamezone. click(iron, 0) toolcheck() wait(waittime) levelup() if mineiron == True: if gamezone.exists(iron2): noore = 0 gamezone.click(iron2, 0) toolcheck() wait(waittime) levelup() #COPPER if minecopper == True: if gamezone.exists(copper): noore = 0 gamezone.click(copper, 0) toolcheck() wait(waittime) levelup() if minecopper == True: if gamezone.exists(copper2): noore = 0 gamezone.click(copper2, 0) levelup() toolcheck() wait(waittime) #BRONZE if minebronze == True: if gamezone.exists(bronze): noore = 0 gamezone.click(bronze, 0) toolcheck() wait(waittime) levelup() if minebronze == True: if gamezone.exists(bronze2): noore = 0 gamezone.click(bronze2, 0) levelup() toolcheck() wait(waittime) #COBALT if minecobalt == True: if gamezone.exists(cobalt): noore = 0 gamezone.click(cobalt, 0) toolcheck() wait(waittime) levelup() if minecobalt == True: if gamezone.exists(cobalt2): noore = 0 gamezone.click(cobalt2, 0) toolcheck() wait(waittime) levelup() #MANGANESE if minemanganese == True: if gamezone.exists(manganese): noore = 0 gamezone.click(manganese, 0) toolcheck() wait(waittime) levelup() if minemanganese == True: if gamezone.exists(manganese2): noore = 0 gamezone.click(manganese2, 0) toolcheck() wait(waittime) levelup() else: noore = 1 pass #TIN if minetin == True: if gamezone.exists(tin): noore = 0 gamezone.click(tin, 0) toolcheck() wait(waittime) levelup() if minetin == True: if gamezone.exists(tin2): noore = 0 gamezone.click(tin2, 0) toolcheck() wait(waittime) levelup() else: noore = 1 pass #SILVER if minesilver == True: if gamezone.exists(silver): noore = 0 gamezone.click(silver, 0) toolcheck() wait(waittime) levelup() if minesilver == True: if gamezone.exists(silver2): noore = 0 gamezone.click(silver2, 0) toolcheck() wait(waittime) levelup() else: noore = 1 pass #BAUXITE if minebauxite == True: if gamezone.exists(bauxite): noore = 0 gamezone.click(bauxite, 0) toolcheck() wait(waittime) levelup() if minebauxite == True: if gamezone.exists(bauxite2): noore = 0 gamezone.click(bauxite2, 0) toolcheck() wait(waittime) levelup() else: noore = 1 pass #GOLD if minegold == True: if gamezone.exists(gold): noore = 0 gamezone.click(gold, 0) toolcheck() wait(waittime) levelup() if minegold == True: if gamezone.exists(gold2): noore = 0 gamezone.click(gold2, 0) toolcheck() wait(waittime) levelup() else: noore = 1 pass while ui.exists(Pattern("1327685097892.png").similar(0.94), 0): #while this image on screen it keep looping this. letsmine() #Start mining module fight() #run fight module if closebutton.exists(Pattern("Close.png").similar(0.89), 0): #Check if fight is over fightover() #call fightover module and close it. else: if noore == 1: #if no ore founded call room changer module. #Choose where you are mining and add comment symbol (#) front of other modules. mine5_19() #room change module for Amakna tunnel 5,19 #mine22_22() #room change module for mine -22,22 pass ----------------------------------------------- this is the original one i also upload all file with the pictures if you need to see you can download http://www.mediafire.com/file/5uuml3fvin044c6/mine last.sikuli.rar Thank you -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. _______________________________________________ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp