stuck in some place :(

Asked by daymond

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

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
daymond (daymond-the-sadida) said :
#1

or if u have better idea to do this let me know thanks

Revision history for this message
RaiMan (raimund-hocke) said :
#2

you should contact the creator of the script.

No-one here will be able to step into such game script without knowing the game.

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

It seems to me that the value of the noore variable is never changed and will always be 0. So the test "if noore == 1" will always be false.

Can you help with this problem?

Provide an answer of your own, or ask daymond for more information if necessary.

To post a message you must log in.