Checking if a label will accept an argument
Posted: Sun Oct 22, 2017 4:00 am
Hi,
I want to make a renpy call to a label with an argument as error-proof as possible. The labels will be written by other people, so I have no way to make sure they include an argument or not.
I am trying to work around the following not working in renpy:
I can use this to make sure the label exists:
But how can I check if the label allows for an argument without throwing an error?
I want to make a renpy call to a label with an argument as error-proof as possible. The labels will be written by other people, so I have no way to make sure they include an argument or not.
I am trying to work around the following not working in renpy:
Code: Select all
python:
try:
renpy.call(lbl, arg)
except ScriptError:
renpy.say("", "Label not found or doesn't accept arguments.")
Code: Select all
if renpy.has_label(lbl):
call expression lbl pass arg
else:
"This label doesn't exist."