renpy/doc/cookbook/Timed menus

From Ren'Py

Jump to: navigation, search

Timed menus

Now, with ui.timer being implemented, we finally could make visual novels little more time-sensitive. For more fun and thrill. This recipe lets you make a new option in menus -- choose nothing, just by waiting some time. Basic concept is: You set a timer before menu, and if it expires, jump to "user didn't choose anything" branch. Note that you must inform player about time left for him to choose.

    $ ui.timer(10.0, ui.jumps("menu1_slow"))
    menu:
        "Choice 1":
            hide countdown
            e "You chosed 'Choice 1'"
            jump menu1_end
        "Choice 2":
            hide countdown
            e "You chosed 'Choice 2'"
            jump menu1_end

label menu1_slow:
    hide countdown
    e "You didn't choose anything."

label menu1_end:
    e "Anyway, let's do something else."

More elaborate use of this is dynamic timed menus. This lets you "change" menu choices presented to user over time. Like this:

    $ ui.timer(10.0, ui.jumps("menu2_v2"))
    menu:
        "Choice 1 fast":
            hide countdown2
            e "You chosed 'Choice 1' fast"
            jump menu2_end
        "Choice 2 fast":
            hide countdown2
            e "You chosed 'Choice 2' fast"
            jump menu2_end

label menu2_v2:
    $ ui.timer(10.0, ui.jumps("menu2_slow"))
    hide countdown2
    show countdown at Position (xalign = 0.5, yalign = 0.1)
    menu:
        "Choice 1 slow":
            hide countdown
            e "You chosed 'Choice 1', but was slow"
            jump menu2_end
        "Choice 2":
            hide countdown
            e "You chosed 'Choice 2', but was slow"
            jump menu2_end

label menu2_slow:
    hide countdown
    e "You was really slow and didn't choose anything."

label menu2_end:
    e "Anyway, let's do something else."

And lastly, I admit that whole concept was shamelessly ripped off from the great VN/TRPG series "Sakura Taisen"

Personal tools