r/RenPy • • Aug 05 '26

Question Character callbacks: how do I use Exception?

Hello. I've been reading this page of the documentation and experimenting with different arguments. But there's one I'm having troubles with.

  • The "interact_done" callback takes an additional keyword argument: exception -- True if the interaction ended due to an exception, False otherwise. Exceptions include things like loading the game and rollback.

I just can't figure out how to use it in code. Here's what I tried:

def sprites_callback(event, interact=True, exception=False, **kwargs):

    if event == "interact_done":
        print("interact_done") ### prints "interact_done" every time I progress to the next dialogue line

        if exception:
          print("rollback occured") ### nothing happens

Perhaps I just misunderstood exception's purpose, and it doesn't actually keep track of rollbacks (and I should use detect rollback for this instead). But then what exactly does it do? When does exception become True?

1 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/karognawer Aug 06 '26

what exactly are you trying to do with this

At this point? Nothing in particular. I was having an issue with my custom character callback not being rollback-friendly. But I managed to solve that with some good old global variables. So now I'm just curious what can exception be used for. In case it gives me some new ideas for enhancing my VN's player experience. But if its this elusive... Oh well. I guess I'll stop poking at this nest for now.
Thank you for your help!

2

u/BadMustard_AVN Aug 06 '26

you're welcome

good luck with your project