My menus are looped so that when talking to one person you see the menu several times
example:
Code: Select all
menu person_a:
"Really?":
"Wow, really?"
"What happened then?":
"And then what happened?
"Goodbye":
"Goodbye!"
jump person_aThe problem is that this is a persistent value. So if I start a new game I will have the choices marked even though I didn't pick them in this playthrough.
Using the search method I found this:
And it seems the exact thing I need! However, it seems to be old and doesn't work out of the box anymore. Gives an error saying:apricotorange wrote: ↑Tue Jul 02, 2013 2:41 amPut the following somewhere in your project, and the "chosen" boolean will work the way you want:
Code: Select all
init python: # Track which choices have been chosen chosen_choice_tracker = None # Action for menu which tracks the chosen choice. class NonPersistentChoice(Action): def __init__(self, label, value, location): self.label = label self.value = value self.location = location def __call__(self): chosen_choice_tracker[(self.location, self.label)] = True return self.value def menu(items): global chosen_choice_tracker if not chosen_choice_tracker: chosen_choice_tracker = {} # Get the name of the current statement # (This is not a public API, but I couldn't find an equivalent.) location = renpy.game.context().current # Build the list of items in the form the screen wants item_actions = [ ] for (label, value) in items: action = NonPersistentChoice(label, value, location) item_actions.append((label, action, (location, label) in chosen_choice_tracker)) # Display the screen return renpy.call_screen("choice", items=item_actions)
Code: Select all
TypeError: list indices must be integers, not ChoiceReturnSo, any ideas on how this code could be made to run in the current version of Renpy or another way of achieving what I need?
