[solved] list of names for secrets

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
The King
Regular
Posts: 35
Joined: Fri Sep 25, 2020 12:37 pm
Completed: 0
Projects: LB
Contact:

[solved] list of names for secrets

#1 Post by The King » Tue Oct 13, 2020 11:15 pm

Hello, so I've got a little problem. Recently, I added code for a male and female selection. The code looks like this:

............................................................................
define m_name_default = "Jack"
define f_name_default = "Erika"
default m_name = m_name_default
default f_name = f_name_default
define m = Character("[m_name]")
define f = Character("[f_name]")
label name_input:
menu:
"Male":
$ is_male = True
"I see."
"Female":
$ is_male = False
"Interesting."
$ input = renpy.input("What is your name, young grasshopper?").strip()
if is_male:
$ m_name = input if input else m_name_default
menu:
"Are you sure?"
"Yes.":
return
"No.":
jump name_input
else:
$ f_name = input if input else f_name_default
menu:
"Are you sure?"
"Yes.":
return
"No.":
jump name_input
label start:
call name_input
$if m_name == "Mario"
jump mariosecret

I want to add a list of names where the game will take you to a secret scene based on that name. Such as Mario, which will take you to a brief Mario scene. Problem is, when I tried to do that, I get this error:

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


File "game/script.rpy", line 40: Line is indented, but the preceding one-line python statement statement does not expect a block. Please check this line's indentation.
jump mariosecret
^

Ren'Py Version: Ren'Py 7.3.5.606

What have I done wrong now? I want to add this name, and others to a list for both the male and female option. Each of which jump to another part of the script for a short scene. How can I make it so it does that? Please help me, I'm still new to coding in Ren'Py. :)
Last edited by The King on Wed Oct 14, 2020 12:36 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: list of names for secrets

#2 Post by Per K Grok » Wed Oct 14, 2020 12:14 am

The King wrote:
Tue Oct 13, 2020 11:15 pm
Hello, so I've got a little problem. Recently, I added code for a male and female selection. The code looks like this:

-----

$if m_name == "Mario"
jump mariosecret

I want to add a list of names where the game will take you to a secret scene based on that name. Such as Mario, which will take you to a brief Mario scene. Problem is, when I tried to do that, I get this error:

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


File "game/script.rpy", line 40: Line is indented, but the preceding one-line python statement statement does not expect a block. Please check this line's indentation.
jump mariosecret
^

Ren'Py Version: Ren'Py 7.3.5.606

What have I done wrong now? I want to add this name, and others to a list for both the male and female option. Each of which jump to another part of the script for a short scene. How can I make it so it does that? Please help me, I'm still new to coding in Ren'Py. :)


change
$if m_name == "Mario"
to
if m_name == "Mario":

User avatar
The King
Regular
Posts: 35
Joined: Fri Sep 25, 2020 12:37 pm
Completed: 0
Projects: LB
Contact:

Re: list of names for secrets

#3 Post by The King » Wed Oct 14, 2020 12:36 pm

Wow, that was a really simple fix. Thank you for your help. :)

Post Reply

Who is online

Users browsing this forum: No registered users