← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #188360]: Cant use def!?!?

 

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

    Status: Solved => Open

danne95 is still having a problem:
When i added this i got this error message: 
[error] Stoppad
[error] Ett fel uppstod på rad 221
[error] Felmeddelande: Traceback (most recent call last):
 File "C:\Users\Daniel\AppData\Local\Temp\sikuli-tmp892078388341814867.py", line 221, in 
 if noore == 1: #if no ore founded call room changer module.
NameError: global name 'noore' is not defined

It says i have not defined noore but noore should not be defined. HELP
:D

The code i added:

#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(pic, 0):
        currentroom = 1
        gamezone.click(pic, 0)
        lastroom = 1

        
    if gamezone.exists(pic, 0):
        currentroom = 2
        if lastroom == 1:
            gamezone.click(pic, 0)            
            lastroom = 2
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

                
    if gamezone.exists(pic, 0):
        currentroom = 3
        if lastroom == 2:
            gamezone.click(pic, 0)
            lastroom = 3
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1


    if gamezone.exists(pic, 0):
        currentroom = 4
        if lastroom == 3:
            gamezone.click(pic, 0)
            lastroom = 4
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

                
    if gamezone.exists(pic, 0):
        currentroom = 5
        if lastroom == 4:
            gamezone.click(pic, 0)
            lastroom = 5
            wait (2)
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

                
    if gamezone.exists(pic, 0):
        currentroom = 6
        if lastroom == 5:
            gamezone.click(pic, 0)
            lastroom = 6
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

                
    if gamezone.exists(pic, 0):
        currentroom = 7
        if lastroom == 6:
            gamezone.click(pic, 0)
            lastroom = 7
            wait (2)
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

    if gamezone.exists(pic, 0):
        currentroom = 8
        if lastroom == 7:
            gamezone.click(pic, 0)
            lastroom = 8
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1
                
    if gamezone.exists(pic, 0):
        currentroom = 9
        if lastroom == 8:
            gamezone.click(pic, 0)
            lastroom = 9
            wait (2)
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1
                
                
    if gamezone.exists(pic, 0):
        currentroom = 10
        if lastroom == 9:
            gamezone.click(pic, 0)
            lastroom = 10
        else:
            if currentroom == lastroom:
                lastroom = lastroom - 1

                
    if gamezone.exists(pic, 0):
        currentroom = 1
        if lastroom == 10:
            gamezone.click(pic, 0)

while ui.exists(pic, 0): #while this image on screen it keep looping this.
    letsmine() #Start mining module
    fight() #run fight module
    if closebutton.exists(pic, 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.
            mine5_19()
        pass

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.