Page 1 of 1

Checking if a label will accept an argument

Posted: Sun Oct 22, 2017 4:00 am
by goldo
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:

Code: Select all

python:
	try:
		renpy.call(lbl, arg)
	except ScriptError:
		renpy.say("", "Label not found or doesn't accept arguments.")
I can use this to make sure the label exists:

Code: Select all

if renpy.has_label(lbl):
	call expression lbl pass arg
else:
	"This label doesn't exist."
But how can I check if the label allows for an argument without throwing an error?

Re: Checking if a label will accept an argument

Posted: Sat Nov 04, 2017 7:45 pm
by goldo
I guess it can't be done then?

Re: Checking if a label will accept an argument

Posted: Sat Nov 04, 2017 10:27 pm
by trooper6
Why are other people writing labels that you don't know what they are?

Re: Checking if a label will accept an argument

Posted: Wed Nov 08, 2017 5:04 pm
by goldo
I am trying to enable some simple form of modding in the shape of adding events written in Ren'py. I don't have to block potential errors and push that responsibility onto the modders, but some of them are new to this stuff and one of them will most likely forget to use the argument... Breaking things when I 'd rather keep the game flow going.