I'm very new to python and renpy, but what I can find on this issue is either to basic or I don't know what to search for. Anyway, my problem is:
- I have a bunch of variables to store character information in.
- ...for multiple characters
- I would like to show those on a screen, where you can also modify these informations.
I got so far to show them on a screen and have the information as buttons with "input"-displayable like this: So you can select the person on the left and my programm takes all the information about this character out of the Characters[][][] list and fills the "form" with it.
Then you can click on those entries (buttons on the right side) to modify them. I have this input as a local variable "characters_0_1", but how do I get this input back into my list? Or maybe a field or something.
As far as I understand it, you can't use the SetVariable-action, because you can't access the individual list items with beeing forced to put the list in quotation marks.
And I have to use some kind of list or field (i don't know fields), because I don't know how else I could access a set of variables in a context sensitive manner (with "person x" beeing the context and "information 1 to y" being the set of variables.)
a cropped down version of my code, which shows only the necessary stuff:
Code: Select all
default Characters = [ # variable from another file
[True, None, "", "Person", "1"], # Character 01
[True, None, "", "Person", "2"], # Character 02
and so on
]
default characters_0_1 = "" # variable for the character-form
default characters_0_2 = "" # variable for the character-form
default inp_val_1 = VariableInputValue('characters_0_1',default=False,returnable=False) # InputValue for the character-form
default inp_val_2 = VariableInputValue('characters_0_2',default=False,returnable=False) # InputValue for the character-form
screen characters(scroll=None, yinitial=0.0):
tag menu
frame:
hbox:
#(left side frame with list of characters)
frame:
for i in range(len(Characters[0])):
if Characters[0][i][0]: # shows characters already known
textbutton [Characters[0][i][3]+" "+Characters[0][i][4]] action [ # charactername - button
SetVariable("characters_0_1",Characters[0][i][3]), # copy first name into form
SelectedIf(SetVariable("characters_0_2",Characters[0][i][4])) # copy last name into form
]
#(right side frame with character information)
frame:
fixed:
order_reverse True # This ensures the input will get the enter event before any of the buttons do.
hbox:
xpos 60 ypos 235
button: # last name of character with input
key_events True
action inp_val_2.Toggle()
input:
value inp_val_2
button: # first name of character with input
key_events True
action inp_val_1.Toggle()
input:
value inp_val_1