[solved] 2 entered names?

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] 2 entered names?

#1 Post by The King » Mon Oct 05, 2020 11:43 pm

I don't know if this has been asked already, but I was wondering if it's possible to have a player enter 2 separate names. I was thinking of having a player enter one name, and then have them enter a nickname. So here's what I tried, the dots in between representing some lines of dialogue in between.

$ name = renpy.input("What is your name?")
$ name = name.strip()
..........................................................................................................................................................................................................
$ player_name = renpy.input("What is your nickname?")
$ player_name = name.strip()

The code located below is what I used for the related characters.

define i = Character('[name]')
define mc = Character('[player_name]')

The problem is, the game seems to only recognize the first name entered, even when using the approprite character in dialogue. For example:

i "My name is [name]."
mc "but you can call me [player_name]."

Is it even possible to add multiple nicknames? If so, how could I do that? Thank you. :)
Last edited by The King on Tue Oct 06, 2020 1:40 pm, edited 3 times 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: 2 entered names?

#2 Post by Per K Grok » Tue Oct 06, 2020 12:21 am

The King wrote:
Mon Oct 05, 2020 11:43 pm
I don't know if this has been asked already, but I was wondering if it's possible to have a player enter 2 separate names. I was thinking of having a player enter one name, and then have them enter a nickname. So here's what I tried, the dots in between representing some lines of dialogue in between.

$ name = renpy.input("What is your name?")
$ name = name.strip()
..........................................................................................................................................................................................................
$ player_name = renpy.input("What is your nickname?")
$ player_name = name.strip()

The code located below is what I used for the related characters.

define i = Character('[name]')
define mc = Character('[player_name]')

The problem is, the game seems to only recognize the first name entered, even when using the approprite character in dialogue. For example:

i "My name is [name]."
mc "but you can call me [player_name]."

Is it even possible to add multiple nicknames? If so, how could I do that? Thank you. :)
Your problem is with the line

$ player_name = name.strip()

it should be

$ player_name = player_name.strip()

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

Re: 2 entered names?

#3 Post by The King » Tue Oct 06, 2020 1:16 pm

Okay, I seems like I got it to work now. Thank you for your help. :)

Post Reply

Who is online

Users browsing this forum: No registered users