call_in_new_context?
Posted: Thu Dec 26, 2019 2:42 pm
Trying to make sure I understand something.
I was trying to write something vaguely like this:
Script:
Inside "an_object":
and
So, a method call from my main script calls a Ren'py label which does an interaction with the user, then I want to resume my Python method, and eventually return back to the original script. (If I was designing this from scratch, I probably wouldn't do it this way, but I have a bunch of existing game code, and I'm trying to migrate some of the operations while not breaking a bunch of existing stuff.)
What I'm finding is that the Python code immediately after "renpy.call(my_label") never gets executed. Instead, I end up back it my main script, without "do some more calculations" being executed.
Is this a case where I should be using "renpy.call_in_new_context" instead of just "renpy.call"? Is that the reason my Python function doesn't resume? Or is this something that you just can't do? (script -> Python -> script and back again)
I was trying to write something vaguely like this:
Script:
Code: Select all
someone "says something"
$ an_object.a_method()
someone "says something"
Code: Select all
def a_method(self):
do some calculations
renpy.call(my_label)
do some more calculations
Code: Select all
label my_label:
show screen notification_popup
pause
hide screen notification_popup
return
What I'm finding is that the Python code immediately after "renpy.call(my_label") never gets executed. Instead, I end up back it my main script, without "do some more calculations" being executed.
Is this a case where I should be using "renpy.call_in_new_context" instead of just "renpy.call"? Is that the reason my Python function doesn't resume? Or is this something that you just can't do? (script -> Python -> script and back again)