Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
ScriptError: could not find label 'test_label(5)'.
It works fine if I omit the parameter (and the default value of 1 is then used). The documentation doesn't detail the mechanism for parameter passing through hyperlinks. Do I need to reimplement the respective hyperlink functions to achieve this?
That is because the hyperlink treats everything set as "a" (the target) as text. So in the case of omitting the parameter it checks for a label named "test_label" which exists and everything works fine. On the other hand, there is no label named "test_label(5)" so it's expected to throw an exception.
To overcome this, you should probably define your own hyperlink callback. Something like
Tsapas wrote:That is because the hyperlink treats everything set as "a" (the target) as text. So in the case of omitting the parameter it checks for a label named "test_label" which exists and everything works fine. On the other hand, there is no label named "test_label(5)" so it's expected to throw an exception.
To overcome this, you should probably define your own hyperlink callback. Something like
(of course the above is not bound to work, it's not even tested. It just serves as an example)
It looks like pulling the arguments out to pass to renpy.call_in_new_context requires renpy.parser.parse_arguments, which requires me to set up a Lexer which wants all this other state as well, so it seems like a thoroughly tiresome thing to try and implement.
I'll just implement this in a less general way by adding stuff to a hyperlink callback for each thing I want to use.