Error: global name '_menu' is not defined

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
neometalero
Regular
Posts: 198
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Error: global name '_menu' is not defined

#1 Post by neometalero »

Im getting this code error when I start the game.

Code: Select all

I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\bootstrap.py", line 295, in bootstrap
    renpy.main.main()
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\main.py", line 430, in main
    renpy.game.script.report_duplicate_labels()
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\script.py", line 890, in report_duplicate_labels
    if renpy.parser.report_parse_errors():
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\parser.py", line 2543, in report_parse_errors
    renpy.display.error.report_parse_errors(full_text, error_fn)
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\display\error.py", line 179, in report_parse_errors
    error_fn=error_fn,
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\game.py", line 280, in invoke_in_new_context
    return callable(*args, **kwargs)
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\display\error.py", line 43, in call_exception_screen
    return renpy.ui.interact(mouse="screen", type="screen", suppress_overlay=True, suppress_underlay=True)
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\RenPy\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2519, in interact
    i()
  File "renpy/common/00voice.rpy", line 360, in voice_interact
    if _menu:
NameError: global name '_menu' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Attack Helicopter DateSim 1.0


This is the code I had initially

Code: Select all

label piedradueloHermano:

#hay que poner variable para duelo ganado o perdido, y cuando llegue a eso salte a lo que corresponda
default hermanoGanarle = 0
default hermanoGanando = 0

#las condiciones para que se repita esto
label condicionesdueloHermano:
    if hermanoGanarle==2:  #va a la que le ganas al hermano
        jump ganasteAlHermano
    if hermanoGanando==2:  #aqui va cuando le ganas
        jump perdisteDueloRPS
    "%(hermanoGanando)s  hermano va ganando " #muestra en que estan las variables para que sepa
    "%(hermanoGanarle)s  vas ganando " #muestra en que estan las variables para que sepa


menu:
    "Choose rock.":
         jump rock1H
    
    "Choose paper.":
         jump paper1H
         
    "Choose scissors":
         jump scissors1H


label rock1H:
    
    "{i}You chose rock{/i}"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Hasegawa chose rock.{/i}"
        window hide
        show ApaHermElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawH
    elif d3roll==2:
        "{i}Hasegawa chose paper.{/i}"
        window hide
        show ApaHermElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseH
    else:
        "{i}Hasegawa chose scissors.{/i}"
        window hide
        show ApaHermElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinH
    
label paper1H:
    "{i}You chose paper{/i}"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Hasegawa chose rock.{/i}"
        window hide
        show ApaHermElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinH
    elif d3roll==2:
        "{i}Hasegawa chose paper.{/i}"
        window hide
        show ApaHermElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawH
    else:
        "{i}Hasegawa chose scissors.{/i}"
        window hide
        show ApaHermElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseH
    
label scissors1H:
    "{i}You chose scissors"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Hasegawa chose rock.{/i}"
        window hide
        show ApaHermElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseH
    elif d3roll==2:
        "{i}Hasegawa chose paper.{/i}"
        window hide
        show ApaHermElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinH
    else:
        "{i}Hasegawa chose scissors.{/i}"
        window hide
        show ApaHermElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawH
    


#Las imagenes de resultados del hermano
label roundwinH:
    "{i}You win this round{/i}"
    window hide
    show ApaHermPosDer
    with moveinright
    $ renpy.pause(0.8)
   
    $hermanoGanarle+=1 #aumenta la variable del jugador
    #esto es para esconder la parte de la mano
    hide ApaHermElecPapel
    hide ApaHermElecPiedra
    hide ApaHermElecTijera
    with dissolve
    hide ApaHermPosDer
    with dissolve
    jump condicionesdueloHermano

label roundloseH:
    "{i}You lose this round{/i}"
    window hide
    show ApaHermPosVict
    with moveinright
    $ renpy.pause(0.8)
    
    $hermanoGanando+=1 #aumenta la variable del rival
    #esto es para esconder la parte de la mano
    hide ApaHermElecPapel
    hide ApaHermElecPiedra
    hide ApaHermElecTijera
    with dissolve
    hide ApaHermPosVict
    with dissolve

    jump condicionesdueloHermano
    
label rounddrawH:
    "{i}The round ended up in a draw.{/i}"
    window hide
    show ApaHermPosEmp
    with moveinright 
    $ renpy.pause(0.8)
    
    #aqui no afecta ninguna variable
    #esto es para esconder la parte de la mano
    hide ApaHermElecPapel
    hide ApaHermElecPiedra
    hide ApaHermElecTijera
    with dissolve
    hide ApaHermPosEmp
    with dissolve

    jump condicionesdueloHermano
This is the code I added and that I think is conflicting

Code: Select all


label piedradueloPadre:

#hay que poner variable para duelo ganado o perdido, y cuando llegue a eso salte a lo que corresponda
default PadreGanarle = 0
default PadreGanando = 0

#las condiciones para que se repita esto
label condicionesdueloPadre:
    if PadreGanarle==2:  #va a la que le ganas al Padre
        jump ganasteAlPadre
    if PadreGanando==2:  #aqui va cuando perdes
        jump perdisteDueloRPS
    "%(PadreGanando)s  Padre va ganando " #muestra en que estan las variables para que sepa
    "%(PadreGanarle)s  vas ganando " #muestra en que estan las variables para que sepa


menu:
    "Choose rock.":
         jump rock1P
    
    "Choose paper.":
         jump paper1P
         
    "Choose scissors":
         jump scissors1P


label rock1P:
    
    "{i}You chose rock{/i}"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Saraf chose rock.{/i}"
        window hide
        show ApaPadreElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawP
    elif d3roll==2:
        "{i}Saraf chose paper.{/i}"
        window hide
        show ApaPadreElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseP
    else:
        "{i}Saraf chose scissors.{/i}"
        window hide
        show ApaPadreElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinP
    
label paper1P:
    "{i}You chose paper{/i}"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Saraf chose rock.{/i}"
        window hide
        show ApaPadreElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinP
    elif d3roll==2:
        "{i}Saraf chose paper.{/i}"
        window hide
        show ApaPadreElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawP
    else:
        "{i}Saraf chose scissors.{/i}"
        window hide
        show ApaPadreElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseP
    
label scissors1P:
    "{i}You chose scissors"
    $ d3roll = renpy.random.randint(1,3)
    "%(d3roll)s "  #prueba para ver si funca la variable, sacar luego
    if d3roll==1:
        "{i}Saraf chose rock.{/i}"
        window hide
        show ApaPadreElecPiedra
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundloseP
    elif d3roll==2:
        "{i}Saraf chose paper.{/i}"
        window hide
        show ApaPadreElecPapel
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump roundwinP
    else:
        "{i}Saraf chose scissors.{/i}"
        window hide
        show ApaPadreElecTijera
        with dissolve
        $ renpy.pause(0.5) #pausa el juego por el tiempo puesto
        jump rounddrawP
        
#Las imagenes de resultados del hermano
label roundwinP:
    "{i}You win this round{/i}"
    window hide
    show ApaPadrPosDer
    with moveinright
    $ renpy.pause(0.8)
   
    $PadreGanarle+=1 #aumenta la variable del jugador
    #esto es para esconder la parte de la mano
    hide ApaPadreElecPapel
    hide ApaPadreElecPiedra
    hide ApaPadreElecTijera
    with dissolve
    hide ApaPadrPosDer
    with dissolve
    jump condicionesdueloPadre

label roundloseH:
    "{i}You lose this round{/i}"
    window hide
    show ApaPadrPosVict
    with moveinright
    $ renpy.pause(0.8)
    
    $PadreGanando+=1 #aumenta la variable del rival
    #esto es para esconder la parte de la mano
    hide ApaPadreElecPapel
    hide ApaPadreElecPiedra
    hide ApaPadreElecTijera
    with dissolve
    hide ApaPadrPosVict
    with dissolve

    jump condicionesdueloPadre
    
label rounddrawH:
    "{i}The round ended up in a draw.{/i}"
    window hide
    show ApaPadrPosEmp
    with moveinright 
    $ renpy.pause(0.8)
    
    #aqui no afecta ninguna variable
    #esto es para esconder la parte de la mano
    hide ApaPadreElecPapel
    hide ApaPadreElecPiedra
    hide ApaPadreElecTijera
    with dissolve
    hide ApaPadrPosEmp
    with dissolve

    jump condicionesdueloPadre
    

Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Error: global name '_menu' is not defined

#2 Post by xavimat »

Check if you have duplicated label names.

Check also the indentation, you should have your "default" outside any label.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Error: global name '_menu' is not defined

#3 Post by PyTom »

This is an issue we had awhile back, but it's fixed in the latest Ren'Py downloads.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
neometalero
Regular
Posts: 198
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Error: global name '_menu' is not defined

#4 Post by neometalero »

Tks. I had duplicated labels , I took forever to find them. It would be great if the engine would tell me where are the duplicated labels.
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Error: global name '_menu' is not defined

#5 Post by PyTom »

Yes, if you upgraded to a current version of Ren'Py, it does.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]