In Game Choices - I keep getting error messages SOLVED

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
eStuff
Newbie
Posts: 6
Joined: Thu Jun 15, 2017 7:02 am
Contact:

In Game Choices - I keep getting error messages SOLVED

#1 Post by eStuff »

I have been trying for a couple of days now. I've looked everywhere, on here, on youtube, even on the ren'py wiki page thing. The tutorial that ren'py provides isn't really that helpful either.

The problem is that I am trying to have the player make a choice in the beginning of the game, and when I try to run the game to test it, then it gives me something like

Parsing the script failed.
File "game/script.rpy" , line 43: expected menuitem -> jump boy

And the thing is, I am using New GUI Interface, not Legacy Theme Interface. I don't know if it should matter or not which interface I am using, but I thought I'd mention it just in case. I found some code that is supposedly supposed to work, so I copied and pasted into my text editor and then I just set it with what I wanted the choices to be.

This is what I have. The 'jump boy' and 'jump girl' are supposed to determine which path the character chooses in the beginning of the game.

Code: Select all

menu:
    "I am a boy."
      jump boy
    "I am a girl."
      jump girl
and I got that 'parsing the script failed' thing. So I went and found that some people had some kind of label next to the menu: term. So I tried it.

Code: Select all

menu:
    "I am a boy."
      jump boy
    "I am a girl."
      jump girl
And I got the same thing. I didn't ever see any if statements in the code I found, and I tried to add some to see if that would work. It didn't. I don't know what I'm doing wrong. Please help me solve this?
Last edited by eStuff on Thu Jun 15, 2017 9:42 pm, edited 1 time in total.

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: In Game Choices - I keep getting error messages

#2 Post by DannyGMaster »

You must add a colon (:) after each choice:

Code: Select all

menu:
    "I am a boy.":
          jump boy
    "I am a girl.":
          jump girl
The silent voice within one's heart whispers the most profound wisdom.

eStuff
Newbie
Posts: 6
Joined: Thu Jun 15, 2017 7:02 am
Contact:

Re: In Game Choices - I keep getting error messages

#3 Post by eStuff »

Alright. That seemed to get rid of the menuitem thing. But now when I run the game I get this, and then renpy crashes.
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
I don't understand what it means. I can't find the mentioned file.

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: In Game Choices - I keep getting error messages

#4 Post by DannyGMaster »

eStuff wrote:Alright. That seemed to get rid of the menuitem thing. But now when I run the game I get this, and then renpy crashes.
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
I don't understand what it means. I can't find the mentioned file.
From what I understand, It means Ren'Py isn't seeing your menu statement for some reason, maybe the problem is somewhere in your code, if you can post the full error report or your code so we can replicate the bug and find a solution.

The file should be in the folder where you extracted the renpy SDK, if you installed in "C:" in a folder called "Renpy6.99", the full route would be:

Code: Select all

C:/Renpy6.99/renpy/common/00voice.rpy
The silent voice within one's heart whispers the most profound wisdom.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: In Game Choices - I keep getting error messages

#5 Post by Imperf3kt »

That issue generally means you have a duplicate label somewhere.
Make sure all labels and variables etc use unique names or you will confuse Ren'Py
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

eStuff
Newbie
Posts: 6
Joined: Thu Jun 15, 2017 7:02 am
Contact:

Re: In Game Choices - I keep getting error messages

#6 Post by eStuff »

I have multiple scripts for different branches. here is the first one that is just the regular 'script.rpy'

Code: Select all

# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define p = Character("[player_name]")
## girls
define d = Character("Dasi")
define h = Character("Hinami")
define r = Character("Ryo")
define m = CHaracter("Mom")
## boys
define t = Character("Tomei")
define y = Character("Yuu")
define o = Character("Ouo")
define f = Character("Dad")
define e = Character("Mr. Eba")


# The game starts here.

label start:

    # Show a background. This uses a placeholder by default, but you can
    # add a file (named either "bg room.png" or "bg room.jpg") to the
    # images directory to show it.

    scene bg room

    # This shows a character sprite. A placeholder is used, but you can
    # replace it by adding a file named "eileen happy.png" to the images
    # directory.

    show eileen happy

    # These display lines of dialogue.

    "please proceed with character set up."
    "Are you a boy, or a girl?"

menu:
    "I am a boy.":
        jump boy
    "I am a girl.":
        jump girl
label boy:
    
    "Do you prefer boys, or girls?"
    
    "I prefer boys":
        jump boyxboy
	"I prefer girls.":
	    jump boyxgirl

label girl:
    
    "Do you prefer boys, or girls?"

    "I prefer boys.":
	    jump girlxboy
    "I prefer girls.":
	    jump girlxgirl

return
Then there are 4 seperate documents that are the main branches.

Code: Select all

## boyxboy
label boyxboy:
    show bg black
$ player_name = ""
$ sdhf = False 
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
    $ player_name = "Kyo"

Code: Select all

## boyxgirl
label boyxgirl:
    show bg black
$ player_name = ""
$ sdhf = False 
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
    $ player_name = "Kyo"

Code: Select all

## girlxboy
label girlxboy:
    show bg black
$ player_name = ""
$ sdhf = False 
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
    $ player_name = "Kiya"

Code: Select all

## girlxgirl
label girlxgirl:
    show bg black
$ player_name = ""
$ sdhf = False 
$ player_name = renpy.input("What is your name?")
$ player_name = player_name.strip()
if player_name == "":
    $ player_name = "Kiya"
I am sure that there is a way to have less code and have just one input code block, I just haven't gotten that far yet.

And when i run it, it says
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 50: expected statement.
"I prefer boys":
^

File "game/script.rpy", line 52: expected statement.
"I prefer girls.":
^

File "game/script.rpy", line 59: expected statement.
"I prefer boys.":
^

File "game/script.rpy", line 61: expected statement.
"I prefer girls.":
^

Ren'Py Version: Ren'Py 6.99.12.4.2187

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: In Game Choices - I keep getting error messages

#7 Post by trooper6 »

1) Your indentation looks off.
2) Under label boy and girl, you forgot the menu statement.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

eStuff
Newbie
Posts: 6
Joined: Thu Jun 15, 2017 7:02 am
Contact:

Re: In Game Choices - I keep getting error messages

#8 Post by eStuff »

I fixed indentation, and I keep getting 'indentation mismatch' errors. I checked the indentation in the script file multiple times and the indentation is completely accurate now. I don't know whats going on. Is there some recommended layout for indentations in the python code?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: In Game Choices - I keep getting error messages

#9 Post by trooper6 »

You also have to fix the second point I brought up...you are doing a menu without menu commands in the labels boy and girl:

Code: Select all

label boy:

    menu:    
        "Do you prefer boys, or girls?"   
        "I prefer boys":
             jump boyxboy
        "I prefer girls.":
             jump boyxgirl

label girl:

    menu:    
        "Do you prefer boys, or girls?"
        "I prefer boys.":
             jump girlxboy
        "I prefer girls.":
             jump girlxgirl
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

eStuff
Newbie
Posts: 6
Joined: Thu Jun 15, 2017 7:02 am
Contact:

Re: In Game Choices - I keep getting error messages

#10 Post by eStuff »

Yes, i fixed that when you brought it up the first time. And thanks for the help guys. If all else fails, I'll start from scratch.
I wasn't too far in.

Post Reply

Who is online

Users browsing this forum: Andredron, Google [Bot]