It was mainly to do with trying to save time copying and pasting a lot of buttons and booleans that had specific actions. So, a screen appearing based on multiple booleans and then buttons for the player to choose from that altered a specific set of variables, before closing the screen and resetting so that only one set of variables has been altered and the screen was ready for another set of variables if need be.
But it might just be that using booleans and multiple buttons is needed considering.
So in this pet shop scenario, there is first an emergency boolean, and then there are multiple emergency types that you can respond to. Let's say three types - a fire, a flood, or the pets escape. And then, there are multiple choices as to how to respond that affect tertiary variables elsewhere (not important for this). The same choice buttons are used for each emergency but their variables were to change based on the emergency type:
Code: Select all
screen pet_shop:
if emergency:
use emergency_choice
#what I didn't want to do
screen emergency_choice:
if fire:
imagebutton "image" action SetVariable("FireThrowWater", True) #etc.
#what I was hoping was possible, with "ThrowWater" being altered based on functions with booleans in init python
screen emergency_choice:
imagebutton "image" action SetVariable("ThrowWater", True) #etc.
timer 0.1 action EmergencyChoices repeat True
init python:
def EmergencyChoices:
#variables
So the ThrowWater would change to 'FireThrowWater' or 'FloodThrowWater' etc. based on the function. Basically it was a timesaving exercise. So rather than changing the True/False value of ThrowWater, I wanted to change the variable it was affecting based on a boolean elsewhere. But it'll probably require specific buttons/booleans within the screen.