I am working on an Ace Attorney-style investigation/mystery game. Currently, I'm refining the way questioning other characters works. It's implemented with the default choice menus and that's all great; HOWEVER.
I would like to have it so that, when you're at the menu, choices that have already been explored have a different look to them than choices that have not yet been selected. The "chosen" boolean in the choice screen was close to what I want, but it's a persistent variable and I need it to operate on a per-playthrough level. Is there a way to do this at all?
If you need any code from me, or need clarification on what I'm looking for, please tell me. I'm new to asking questions so I'm not sure how to go about it. Thanks for your time.
Changing appearance of previously-made choices
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: Changing appearance of previously-made choices
Put 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)
Re: Changing appearance of previously-made choices
That is working exactly right. Thank you so much!
Who is online
Users browsing this forum: Ahrefs [Bot]