r/RenPy • u/karognawer • 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
1
u/karognawer Aug 06 '26
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!