a return from the
renpy.call() function? yes, unless you've used
from_current=True as kwarg. then you would return to the call itself.
As far as I understood it, it's natural, and not scary at all. It's just that
renpy.call
, and especially this parameter, isn't designed to be used in inline Python, but only inside
You must be registered to see the links
(CDS).
Internally, a call is just an exception thrown by Ren'py. Which mean that when you call a label, whatever with the
call
statement or
renpy.call
, Ren'py loose all memories about where it was at this moment. The only thing he remember is the entry point in the AST, or the next one, depending of what thrown the exception.
Therefore, you can't have a CDS that call a label, then either proceed the result, or react according to it.
By setting
from_current
to
True
, Ren'py will proceed the CDS two times. Firstly when it encounter the said CDS, then when he'll return from the called label. This permit your CDS to effectively proceed the new context and/or react to it. The only thing you need is a flag letting you know if it's the first processing of the statement (the one where you've to call), or the second (the one where you've to proceed the result).
The effective utility is limited, but this parameter isn't totally useless.
To stay more or less on context with the thread, you can have a
bed_time
CDS that ask the player how many time he want to sleep, then react accordingly to it.
It can be wrote without CDS :
Code:
[...]
call bed_time
[...]
label bed_time:
menu:
"1 hour":
call advance_time( 1 )
"2 hours":
call advance_time( 2 )
"6 hours" if time > 20:
call advance_time( 6 )
"8 hours" if time > 20:
call advance_time( 8 )
"Until noon" if time > 22:
call advance_time( (24-time) + 12 )
return
or it can be wrote with a CDS :
Code:
[...]
bed_time
[...]
menu bedTimeMenu:
"1 hour":
return( "nap" )
"2 hours":
return( "longNap" )
"6 hours" if time > 20:
return( "shortNight" )
"8 hours" if time > 20:
return( "longNight" )
"Until noon" if time > 22 or time < 6:
return( "noon" )
init python:
def bet_timeProcess( t ):
if not _return in [ "nap", "longName", "shortNight", "longNight", "noon" ] :
renpy.call( "bedTimeMenu", from_current=True )
else:
[proceed the time advance according to the result]
Obviously you can also use
You must be registered to see the links
for this. But using the
menu
statement make the menu easier to write and update, offer you more flexibility, and let you benefit from the parameters, for both the menu and the choices.
This while the time advance processing while be proceeded directly in the function, instead of being a bunch of inline Python lines.