Tutorial Ren'Py Character dossier screen

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,092
I want to implement some sort of a character sheet. A dossier that will show updated info on all characters. A picture of notebook with different text on it. Stats, photo.
Can't find what I need via searching just because I don't know how is it called properly.
So could you please give me a link for a guide with something similar.
 

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,092
Thanks, that's exactly what I was looking for.
Do you by any chance know how to put names in that list from player input?
I wanna let people call characters as they wish. So how do I put player input in declaring character list?
Code:
$ boy = char(
        name="Boy",
If I put "[player_input]" instead of "Boy" I get error.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,232
Everything depend of the way you deal with the characters stats.

If they are on separated variables, it's something like that :
Code:
# The variables where the information are stored.
default char1_name = "something"
default char1_love = 0
default char1_lust = 0
default char2_name = "otherthing"
default char2_love = 0
default char2_lust = 0
# List of all the characters.
default allChars = [ "char1", "char2" ]

screen myCharSheet:

    #  Keep track of which character are actually displayed. The
    # value is the common part to all variables related to this
    # character.
    #  Will be reset to the default value each time you show/call
    # the screen.
    default actualChar = "char1"

    # Buttons to switch from a character to the other
    hbox:
        for c in allChars:
            # Like it's separated variables, you need to find the
            # right value first. Like each variables is stored in the
            # 'store' object, you just need to get the (value of the)
            # attribute with the right name. Said "right name" which
            # is [common part]_[value type].
            $ name = getattr( store, c+"_name" )
            textbutton "[name]":
                 #  When the player click on the button, it will change
                 # the value of the "actualChar", and Ren'py will 
                 # automatically update the screen according to it.
                 action SetScreenVariable( "actualChar", c )

    # Here is the sheet itself.
    vbox:
        # Like above, you need to retrieve the value first.
        $ tmp = getattr( store, actualChar+"_name" )
        # Then simply display it.
        text "Looking at [tmp]"
        $ tmp = getattr( store, actualChar+"_love" )
        text "Love: [tmp]"
        $ tmp = getattr( store, actualChar+"_lust" )
        text "Lust: [tmp]"
And if you use object, it looks like this :
Code:
init python:
    # Basic class for the example.
    class MyChar():
          name = ""
          love = 0
          lust = 0

default char1 = MyChar()
default char2 = MyChar()

# See above.
default allChars = [ char1, char2 ]

screen myCharSheet:

    # This time you store directly the object.
    default actualChar = char1

    hbox:
        for c in allChars:
            #  You don't need to retrieve the value, you can directly
            # address it's attribute in the current object.
            textbutton "[c.name]":
                 action SetScreenVariable( "actualChar", c )

    vbox:
        text "Looking at [actualChar.name]"
        text "Love: [actualChar.love]"
        text "Lust: [actualChar.lust]"
Obviously, it need to be styled, but that's how it's done.
 

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,092
Crap I don't get it.
And I think you misunderstood me. I use the code from that guide Winterfire suggested. Tweaking it for my taste.
I need to show names that player input when I introduce characters in game.

Code:
###defining character
define m = Character("[mc]", who_color="#FFFFFF")

###player input name
$ mc = renpy.input(_("Hi! My name is "), default=__('Alex'), length=10)
    $ mc = mc.strip()
    if m == "":
        $ mc="Alex"

###And then you declare the character with name that already was input by a player

init:
    #declare all the characters here, use the following format. Add as many as you want or need.
    $ Alex = char(
        name="I want that name here",
        bloodType="A",
        major="N/A",
        age="16",
        birthday="Everyday",
        sign="Nope",
        likes="Pizza",
        dislikes="Tacos",
        description="Your neighbor.",
        currentThoughts="I really want pizza.",
        dateable=False,
        pic="girl a 1.png"
        )
How to link player input to "I want that name here" part?
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,504
8,040
That means the variable was not defined, on the page I gave you, did you also write the "init python" part?
 
  • Like
Reactions: P_S_Y_C_H_O

P_S_Y_C_H_O

therappist
Game Developer
Sep 3, 2018
756
3,092
That means the variable was not defined, on the page I gave you, did you also write the "init python" part?
Yes I put everything from the tutorial. Also, according to line number of that error it's here
Code:
 vbox spacing 10:
          vbox:
               text name
               text bloodType
               if major != 'Major: ???':
                  text major
               text age
               text birthday
               text sign
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
5,504
8,040
Unfortunately I am not that good in Python but if the error prints only with "%(mc)s" but works fine by assigning a normal string (like "Girl" on the example from that tutorial), my guess is that it expects a variable with an already defined value, so maybe try to assign the value "Alex" first and then give the possibility to change the name.
 
  • Like
Reactions: P_S_Y_C_H_O