ConditionSwitch - Ren'Py

documentation index ◦ reference manual ◦ function index

# ConditionSwitch

Function: | ConditionSwitch | (*args, **properties):

This is a wrapper around DynamicDisplayable that displays the first displayable matching a condition. It takes an even number of positional arguments, with odd arguments being strings containing python conditions, and odd arguments being displayables. On each interaction, it evaluates the conditions in order to find the first that is true, and then displays that displayable. It is an error for no condition to be true.

If supplied, keyword arguments are used to position the chosen displayable.

## Example

    init:
        image bg waterfront = ConditionSwitch(
            "time_of_day == 'day'", "waterfront_day.jpg",
            "time_of_day == 'night'", "waterfront_night.jpg",
            )

documentation index ◦ reference manual ◦ function index