Hi again everyone,
I know that it is possible in renpy script to call a label while passing a parameter. Per the documentation, I could do this:
<code>
call expression "subroutine" pass (count=3)
# ...
label subroutine(count=1):
</code>
Is it also possible to do something similar from python code? How would I pass a parameter from a jump method (renpy.jump()) to the label's code? At the moment, the only option I can think of is to set a global variable prior to the jump and then have that variable checked in the label's code -- but that seems awfully inelegant. Are there any better solutions?
Thanks in advance!
renpy.jump with parameter
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.
- trekopedia
- Regular
- Posts: 25
- Joined: Thu Sep 14, 2017 11:38 pm
- Location: Toronto, Canada
- Contact:
Re: renpy.jump with parameter
Nope. If that feature existed, it would probably be documented.
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: renpy.jump with parameter
As philat says, jump has no additional arguments other than just label name passed to it, so cannot support what you want.
Even though call can support extra arguments (as you saw in the docs), it has to know where in the script it is located (so it can return to that point if needed). Therefore, to even effectively do a renpy.ast.Call with bonus parameters you would need to add the filename, linenumber tuple which quickly gets messy and might well glitch save/rollback
Though inelegant, the setting global variable values option does seem the best way to go
Even though call can support extra arguments (as you saw in the docs), it has to know where in the script it is located (so it can return to that point if needed). Therefore, to even effectively do a renpy.ast.Call with bonus parameters you would need to add the filename, linenumber tuple which quickly gets messy and might well glitch save/rollback
Though inelegant, the setting global variable values option does seem the best way to go
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
- trekopedia
- Regular
- Posts: 25
- Joined: Thu Sep 14, 2017 11:38 pm
- Location: Toronto, Canada
- Contact:
Re: renpy.jump with parameter
OK. Thanks. I figured the jump method itself wasn't going to be the solution since it wasn't documented, but I thought perhaps I was missing some similar option. Global variable it is! 
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]