sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08949
Re: [Question #188360]: Cant use def!?!?
Question #188360 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/188360
george posted a new comment:
go step by step danne thats what i do at the moment but still couldn't
fix the problem :(
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,0,1280,800)
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
---------------------
[error] Stopped
[error] Error message: IndentationError: ('unindent does not match any outer indentation level', ('C:\\Users\\XXXXX\\AppData\\Local\\Temp\\sikuli-tmp6309182323911585919.py', 84, 3, ' gamezone.click("1330056004176-1.png", 0)\n'))
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.