Expected Menuitem Error

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
humanpencil
Newbie
Posts: 5
Joined: Mon Jun 03, 2019 3:42 am
Projects: Meet the Concil
Tumblr: humanpencilgr
itch: humanpencilgr
Contact:

Expected Menuitem Error

#1 Post by humanpencil » Mon Jun 03, 2019 3:51 am

I have been trying to solve this and have tried everything but nothing worked, forgive me if this is an easy problem to solve, I am a newbie an don't know some things the problem is in line 21 (n "I'm [name]")
menu:
n "I'm [name]"
jump choice1name:


n "First off, who are you?":
jump choice1whoareyou:

Ishigreensa
Newbie
Posts: 17
Joined: Sun Jul 06, 2014 8:11 am
Contact:

Re: Expected Menuitem Error

#2 Post by Ishigreensa » Mon Jun 03, 2019 4:09 am

You cannot jump have the n speaker in the menu.
Try this:
n "Who are you?"
menu:
"I'm [name1]":
n "Nice to meet you, [name]."
jump choice1name
"I'm [name2]":
n "Oh, really?"
jump choice2name


choice1name:
me "Nice to meet you, too."
me "What's next?"

choice2name:
me "Yes, that's my name."

This assumes you have different names to choose from.

if you are making a menu with questions....
menu:
"What's your name?":
n "my name is [name]."
jump nametell
"How old are you?":
n "I'm [age] years old."
jump agetell
"What color do you like?"
n "I like [color]."
jump colortell

label nametell:
n "Nice to meet you, [name]."
return
label agetell:
n "That's uncanny. We're the same age."
return
label colortell:
n "Well, I like green."
return

Does this help?

Arkilos
Newbie
Posts: 6
Joined: Mon Jun 03, 2019 9:20 am
Contact:

Re: Expected Menuitem Error

#3 Post by Arkilos » Mon Jun 03, 2019 12:01 pm

hI
stuck with the same error, tried reading your post, but still did not understand the solution.
Here is my code so far. (note that this my first try at making a game, yet alone a visual novel.

Code: Select all

efine pov = Character ("[povname]")
define pov2 = Character ("[povname2]")
define a = Character ("Uncle")  #Plase holder.
define b = Character ("Sora")


label start:
    "let's start simple."
    "are you a boy, or are you a girl?"

menu:

    "I am a girl":
        jump choice1_girl
    "I am a boy":
        jump choice1_boy

    label choice1_girl: #Problem here. 
        $menu_flag = true

    "Alright, what is your name?"
    python:
        povname = renpy.input ("what is you name")
        povname = povname.strip()

        if not povname:
            povname = "Madori"
    pov "My name is [povname]"

    # scene (train window, Sakura leaves and trees pass by, along with a vast valley in the background)
    "looking out the train window"
    "I watch the rolling hills pass by."
    "I had been five years since I had to lift my home town, and moved to my aunts in Yokohama, where I finished 8th-year studies"
    "A few hours ago, I had learned that my parents had passed away in a house fire."
    "I catch the first houses of Akemi."
    "It is a small coastal town... if only bearly that."
    "most of the people worked in the rice paddies, or out fishing out at sea."

    # run opening credits.

    jump choice1_done

    label choice1_boy:
    $menu_flag = false
    "Alright, what is your name?"
    python:
        povname = renpy.input ("what is your name")
        povname =povname.strip()

        if not povname:
            povname2 = "Saske"
    pov "my name is [povname2]"

    # scene (train window, Sakura leaves and trees pass by, along with a vast valley in the background)
    "looking out the train window"
    "I watch the rolling hills pass by."
    "I had been five years since I had to lift my home town, and moved to my aunts in Yokohama, where I finished 8th-year studies"
    "A few hours ago, I had learned that my parents had passed away in a house fire."
    "I catch the first houses of Akemi."
    "It is a small coastal town... if only bearly that."
    "most of the people worked in the rice paddies, or out fishing out at sea."

    # run opening credits.

    return
    
Here is the Error message

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 18: expected menuitem
    label choice1_girl:
    ^

Ren'Py Version: Ren'Py 7.2.1.457
Mon Jun 03 18:54:33 2019
Novum Arkilum

User avatar
IrinaLazareva
Veteran
Posts: 367
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: IKG
Location: St.Petersburg, Russia
Contact:

Re: Expected Menuitem Error

#4 Post by IrinaLazareva » Mon Jun 03, 2019 12:37 pm

Arkilos wrote:
Mon Jun 03, 2019 12:01 pm

Code: Select all

label start:
    "let's start simple."
    "are you a boy, or are you a girl?"

menu:

    "I am a girl":
        jump choice1_girl
    "I am a boy":
        jump choice1_boy

    label choice1_girl: #Problem here. 
        $menu_flag = true

    "Alright, what is your name?"
    python:
        povname = renpy.input ("what is you name")
        povname = povname.strip()
    

Code: Select all

label start:
    "let's start simple."
    "are you a boy, or are you a girl?"

    menu:      #solve here. 
        "I am a girl":
            jump choice1_girl
        "I am a boy":
            jump choice1_boy

label choice1_girl: #and here. 
    $ menu_flag = true
    "Alright, what is your name?"
    #...
    
https://www.renpy.org/doc/html/language ... and-blocks
There is a light at the end of the tunnel, just pray it's not a train.
___
TODO: unresolved/нерешённое

Arkilos
Newbie
Posts: 6
Joined: Mon Jun 03, 2019 9:20 am
Contact:

Re: Expected Menuitem Error

#5 Post by Arkilos » Mon Jun 03, 2019 1:03 pm

Thank you for your reply.
unfortunately, it proved to be a shinkansen of a train. The game started off running alright, but once I got to the choice whether to play as a boy or girl.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 18, in script
    $ menu_flag = true
  File "game/script.rpy", line 18, in <module>
    $ menu_flag = true
NameError: name 'true' is not defined

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

Full traceback:
  File "game/script.rpy", line 18, in script
    $ menu_flag = true
  File "C:\Users\Novum-Arkilum\Desktop\Visual Novels\renpy-7.2.1-sdk\renpy\ast.py", line 896, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Novum-Arkilum\Desktop\Visual Novels\renpy-7.2.1-sdk\renpy\python.py", line 1929, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 18, in <module>
    $ menu_flag = true
NameError: name 'true' is not defined

Windows-8-6.2.9200
Ren'Py 7.2.1.457
Your Sushi Bar 1.0
Mon Jun 03 20:03:56 2019
Is this problem in the code, or where do I turn to... I am assuming it has to do with the code to type in a name, which I got from the Forum. Outdated maybe?
this is where the code for the text input came from
https://www.renpy.org/doc/html/input.html

problem evolved. now directly linked to the tent input code... I feel like once one problem is solved, another one is generated.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 43, in script
    jump choice1_done
ScriptError: could not find label 'choice1_done'.

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

Full traceback:
  File "game/script.rpy", line 43, in script
    jump choice1_done
  File "C:\Users\Novum-Arkilum\Desktop\Visual Novels\renpy-7.2.1-sdk\renpy\ast.py", line 1674, in execute
    rv = renpy.game.script.lookup(target)
  File "C:\Users\Novum-Arkilum\Desktop\Visual Novels\renpy-7.2.1-sdk\renpy\script.py", line 886, in lookup
    raise ScriptError("could not find label '%s'." % str(original))
ScriptError: could not find label 'choice1_done'.

Windows-8-6.2.9200
Ren'Py 7.2.1.457
Your Sushi Bar 1.0
Mon Jun 03 20:31:50 2019
Last edited by Arkilos on Mon Jun 03, 2019 1:35 pm, edited 1 time in total.
Novum Arkilum

User avatar
Matalla
Regular
Posts: 198
Joined: Wed Mar 06, 2019 6:22 pm
Completed: The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: Expected Menuitem Error

#6 Post by Matalla » Mon Jun 03, 2019 1:32 pm

$menu_flag = true, tries to asign to the variable menu_flag the value of other variable called true (which doesn't exists). If you want to assign a boolean value (true/false) it must be True, like:

Code: Select all

$ menu_flag = True
Comunidad Ren'Py en español (Discord)
Honest Critique

Arkilos
Newbie
Posts: 6
Joined: Mon Jun 03, 2019 9:20 am
Contact:

Re: Expected Menuitem Error

#7 Post by Arkilos » Mon Jun 03, 2019 1:41 pm

Thanks.
:-)

Code: Select all

menu:
        "I am a girl":
            jump choice1_girl
        "I am a boy":
            jump choice1_boy

label choice1_girl:
    $ menu_flag = True  #this the line you are talking about?
    python:
        povname = renpy.input ("alright, what is your name")
        povname = povname.strip()

        if not povname:
            povname = "Madori"
    pov "My name is [povname]"
Novum Arkilum

Post Reply

Who is online

Users browsing this forum: Google [Bot], rames44