Showing chosen [name] when replaying labels?

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
Adrian_DVL
Regular
Posts: 141
Joined: Fri Mar 15, 2019 8:46 am
Completed: Clockwork Poison
Projects: Melodic Dates, Clockwork Poison: Salvation
Contact:

Showing chosen [name] when replaying labels?

#1 Post by Adrian_DVL »

So, I have a replay system in my game (NOT gallery) that player can access through a screen in-game (NOT in the main menu), like this:

Code: Select all

if leah_sc1:
        imagebutton idle "girls/heart_i.png" hover "girls/heart_h.png" xpos 906 ypos 660 hovered tt.Action("Morning exercises") action Replay("library1c")
This works perfectly fine, but there's a problem with the name of the player. I let chose the name of the player when game starts, with this label:

Code: Select all

label name:
    $ name = renpy.input("{color=#d2e38f}What was my name...?{/color}")
    $ name = name.strip()
    if name == "":
        $ name = "Dan"
    return
But this way, a story label works fine, but when I replay that label, every time [name] appears in the dialogue, I got a crash.
So I defaulted the 'name' variable, like this:

Code: Select all

default name = "Dan"
Now it works fine, without crashing, but the game translates [name] as 'Dan' when replaying a label, and not as the name chosen by the player.
So, anyone knows how I can do to get the name that players chose when replaying a label instead of the default one?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]