I ended up doing this and it worked quite well. Although I ended up not using the copy command and just assigned the nvl_list to a different variable for each contact. It looks something like this:
label SaveContact:
if open_text == contact1:
$ contact1 = nvl_list
label LoadContact1:
$ nvl_list = contact1
$ open_text = "contact1"
Viewing post in yet another phone for renpy comments
I can try my best! So first you need a way to save the history of text. I do this by checking which character was open last and save the text history to a variable.
(replace character 1 and 2 with whatever your character's names are and make sure you have defined each of their nvl names)
label history_save:
if open_text == "Character 1": $ character1_history = nvl_list #base renpy variable that already exists elif open_text == "Character 2": $ character2_history = nvl_list
return
Then whenever a text event is called it first updates which character is texting and loads the character's text history. Then after they finish texting it saves.
label Character1_Text1: $ nvl_list = character1_history $ open_text = "Character 1"#this variable can also be used to give each character different visuals on their messaging screen with if statements nvl_narrator "Character 1 added to contacts" c1_nvl "Hello. It's me."
call history_save
return
That should be all you need for basic texting with multiple characters but if you are like me and want to be able to check back whenever at previous texts you need another way to load their texts. All you need is a contacts screen with buttons for each character(there are plenty of tutorials on how to make gui online). When the player clicks on a button, hide the contacts screen and call the label associated with that character.
label character1_history_load: $ nvl_list = character1_history $ open_text = "Character 1" nvl_narrator "" #just an empty text so the nvl screen shows. I know it's weird but it was the only way I could get it to work. $ nvl_list.pop() #removes the empty text show screen ContactsScreen #to go back to the previous screen where you have all your characters contacts listed return
There are probably more optimized ways to do this but I found this is what worked for me and my game. I also have time based events in place and this worked very well with that!
Thank you for your sharing! I think this is what I need, but I try to add the above codes in my game, it just come out with a lot of errors... And as a complete beginner I just don't know what to do... Could you please upload the screen.rpy and the rpy that holding the above labels? I really want to have the contact list and contact history for different characters... Many thanks!!
Hi!! I want to thank you so much for sharing how you did your code. ;-; Sorry if I am bothering you but do let me know if you ever make a separate code for making a contact list and contact history for different characters. I myself am a beginner and just can't figure out how to save the nvl text message history so it can be restored later. I just kept getting errors and I am not completely familiar with python yet. No pressure of course! I bet your game will be so cool when it comes out :3
init python: character1_history = [] character2_history = [] define Character1 = Character('Character1', color="#14d114", kind=nvl) define Character2 = Character('Character2', color="#f6170b", kind=nvl) label start: scene bg room show eileen happy Character1 "Вы создали новую игру Ren'Py." Character1 "Вы создали новую игру Ren'Py." Character1 "Вы создали новую игру Ren'Py." Character1 "Вы создали новую игру Ren'Py." call history_save("Character 1") Character2 "Добавьте сюжет, изображения и музыку и отправьте её в мир!" Character2 "Добавьте сюжет, изображения и музыку и отправьте её в мир!" Character2 "Добавьте сюжет, изображения и музыку и отправьте её в мир!" Character2 "Добавьте сюжет, изображения и музыку и отправьте её в мир!" call history_save("Character 2") jump contacts label history_save(open_text): python: for i in nvl_list: if open_text == "Character 1": character1_history.append(i) elif open_text == "Character 2": character2_history.append(i) nvl clear return label character_history_load(character): if character == "Character 1": $ nvl_list = character1_history nvl_narrator "" $ nvl_list.pop() elif character == "Character 2": $ nvl_list = character2_history nvl_narrator "" $ nvl_list.pop() return label contacts: menu: "choose character" "Character 1": call character_history_load("Character 1") "Character 2": call character_history_load("Character 2") jump contacts