sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #36723
[Question #284705]: stuck in some place :(
New question #284705 on Sikuli:
https://answers.launchpad.net/sikuli/+question/284705
hi guys
what i am trying to do is
First of all, this is a java game and there are specific picture colors.
it should collect wheat etc. in each map then when there is no wheat picture on map it should jump to anothermap
then again should collect wheat etc. then jump other map
again...
then jump next
again
when i come back first map (that i start collecting wheat) i need to repeat the actions over again...
sometimes when u collect wheat you levelup
to avoid error there are extra scripts inside
please help me to fix this
#Cereals images
wheat = Pattern("wheat.png").similar(0.68)
wheat2 = Pattern("wheat2.png").similar(0.53)
#REGIONS: These help script work faster.
gamezone = Region(334,30,1252,863)
ui = Region(1072,899,515,91)
okbutton = Region(890,577,130,43)
closebutton = Region(822,595,262,57)
coordinate = Region(348,46,264,50)
#SETUP
waittime = 5 #this set time between harvesting
#Select harvesting items True= harvest False= dont harvest
harvestwheat = True #WHEAT
#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 harvest_astrub(): #Room swap module
global lastroom
global currentroom
global noore
if coordinate.exists(Pattern("map1.png").targetOffset(117,172), 0):
currentroom = 1
gamezone.click(Pattern("map1.png").targetOffset(117,172), 0)
lastroom = 1
if coordinate.exists(Pattern("map2.png").targetOffset(-171,231), 0):
currentroom = 2
if lastroom == 1:
gamezone.click(Pattern("map2.png").targetOffset(-171,231), 0)
lastroom = 2
else:
if currentroom == lastroom:
lastroom = lastroom - 1
if coordinate.exists(Pattern("1454754739099.png").targetOffset(-228,228), 0):
currentroom = 3
if lastroom == 2:
gamezone.click(Pattern("1454754739099.png").targetOffset(-228,228), 0)
lastroom = 3
else:
if currentroom == lastroom:
lastroom = lastroom - 1
def levelup():
if okbutton.exist("ok.png", 0): #Level up
okbutton.click("ok.png", 0) #Close level up window
else:
pass
def letsharvest(): #Harvest module
global noore
if harvestwheat == True:
if gamezone.exists(wheat):
noore = 0
gamezone. click(wheat, 0)
wait(waittime)
levelup()
if harvestwheat == True:
if gamezone.exists(wheat2):
noore = 0
gamezone.click(wheat, 0)
wait(waittime)
levelup()
while ui.exists("ui.png", 0): #while this image on screen it keep looping this.
letsharvest() #Start harvest module
if closebutton.exists("close.png", 0): #Check if fight is over.
else:
if noore == 1: #if no ore founded call room changer module.
#Choose where you are harvesting and add comment symbol (#) front of other modules.
harvest_astrub() #room change module for Astrub
pass
right now i am getting error on last part
while ui.exists("ui.png", 0): #while this image on screen it keep looping this.
letsharvest() #Start harvest module
if closebutton.exists("close.png", 0): #Check if fight is over.
>>>>>>>>>> over here else:
if noore == 1: #if no ore founded call room changer module.
#Choose where you are harvesting and add comment symbol (#) front of other modules.
harvest_astrub() #room change module for Astrub
pass
and any how its work nothing is happen :(
plz help me guys thanks a lot
(i am at learning proses i am not expert in script thing)
i got this on net & did some tweak
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.