Screen to change player names in RenPy?

AnimArts

Member
Aug 10, 2020
184
901
Hi,
I'm trying to make a screen that allows the player to change the names of characters.

I've borrowed the "About" screen to set up the interface.
The problem I'm have is that after the new name is entered, RenPy does not return to that screen, no matter what I've tried.
I like the player to be able to change other names as well and press "Return " to get back to the game.

Anyone know how to code that? Or has seen this done in other games?

Any help is appreciated!
- AnimArts

(I'd like to get back to the Character Names screen after the player name text input, but I can't figure out how. It always jumps back into the game when I try.)

screen.jpg
 

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,750
16,547
Hi,
I'm trying to make a screen that allows the player to change the names of characters.

I've borrowed the "About" screen to set up the interface.
The problem I'm have is that after the new name is entered, RenPy does not return to that screen, no matter what I've tried.
I like the player to be able to change other names as well and press "Return " to get back to the game.

Anyone know how to code that? Or has seen this done in other games?

Any help is appreciated!
- AnimArts

(I'd like to get back to the Character Names screen after the player name text input, but I can't figure out how. It always jumps back into the game when I try.)

View attachment 1531913
Haven't done this myself, but try this. Add a button to preferences/wherever which opens up a label where a change is made.
Here's a rough template:
Python:
# For preferences screen
if not main_menu:
    textbutton _("Change Names") action (ui.callsinnewcontext("name_change"))

# Label where a change is made
label name_change:
    $ mc_name = renpy.input("Your current name is [mc_name], please enter a new name.")
    $ mc_name = mc_name.strip() or "John"
    return
If you share your code on how you're changing names, it'd be easier to help you.
You should get a dev tag btw, this was brought up recently in the dev section.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,188
(I'd like to get back to the Character Names screen after the player name text input, but I can't figure out how. It always jumps back into the game when I try.)
Well, just use the screen statement, there's really no need to have a label for such thing.

[Warning, wrote on the fly, there's possibly typos]
Code:
default angelaName = "Angela"
default otherCharName = "Whatever"

screen changeName():

    hbox:

        vbox:
            add "angela.jpg"
            input value VariableInputValue("angelaName")

        vbox:
            add "otherchar.jpg"
            input value VariableInputValue("otherCharName")

        [...]