Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
So I have some screens working in my game. When I click on a menu item, it highlights to show it's selected. But I found that the menu items stay highlighted even after leaving the menu.
First, you should understand, how button deterrmines if it is selected or not. First of all it looks for selected property. If provided, button will be selected if it evaluates to True and deselected otherwise. If selected property is not provided, it looks at the actions to determine if button is selected. I do not remember which action is selected if list of actions is provided, but for Set*Variable family of action button is considered selected if variable is already assigned desired value. In your case, for example, it will be selected if variable selected_location equals to location_item.name
TL;DR: reset your variable to None each time the screen is shown.
I do not remember in which cases it reset variables, but at least this SetVariable("selected_location", location_item.name) sets global variable (or, rather, store variable) and not screen variable, so it is not affected by default statement.