I need a way to discard the entire call stack.
I have a complex combat system that, depending on the situation, could be started with a few locations stacked up in the "return from call" stack. I would like to make it so if you completely lose a battle in certain situations, it sends you to a specific location (the player is being sent home to heal), but this would result in a memory leak of sorts, as I'm left with a potentially large call stack that will never be returned to.
When a failure like this happens, I no longer need that call stack (it contains the locations the player went through to get to the battle, and they are no longer there), so I need a way to completely flush the stack.
I already know how to remove the top value with renpy.pop_call(), but in this case, I need to remove the entire stack; assume the height of the stack could vary (so I can't just use pop_call() the "right" number of times).
How to discard the entire call stack?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Re: How to discard the entire call stack?
Set https://www.renpy.org/doc/html/label.ht ... turn_stack to an empty list []
Re: How to discard the entire call stack?
Perfect. Thank you.emz911 wrote: ↑Mon Jul 19, 2021 12:58 am Set https://www.renpy.org/doc/html/label.ht ... turn_stack to an empty list []
Who is online
Users browsing this forum: No registered users