documentation indexreference manualfunction index

renpy.roll_forward_info

Function: renpy.roll_forward_info ():

When re-executing a statement after rollback, this returns the data stored using renpy.checkpoint the last time this statement was executed. If this statement is not being re-executed due to a rollback, this returns None.

Often, this data is passed as the roll_forward parameter of ui.interact. It's important to check to ensure that the value is valid before using it in this way.


Example

python:
    roll_forward = renpy.roll_forward_info()
    if roll_forward not in ("rock", "paper", "scissors"):
        roll_forward = None

    ui.hbox()
    ui.imagebutton("rock.png", "rock_hover.png", clicked=ui.returns("rock"))
    ui.imagebutton("paper.png", "paper_hover.png", clicked=ui.returns("paper"))
    ui.imagebutton("scissors.png", "scissors_hover.png", clicked=ui.returns("scissors"))
    ui.close()

    choice = ui.interact(roll_forward=roll_forward)
    renpy.checkpoint(choice)



documentation indexreference manualfunction index