Skip to content

return

Syntax

return [<return value>];

Description

This command causes the script execution to leave previously called function with callfunc() or script with callsub() and return to the location, where the call originated from. Optionally a return value can be supplied, when the call was done using the function form.

Using this command outside of functions or scripts referenced by callsub() will result in error and termination of the script.

Examples

	set(.@var, callsub(L_myAddition, .@a_val, .@b_val));
	mes("The result is " + .@var + ".");
	close();
L_myAddition:
	return getarg(0) + getarg(1);
	set(.@var, callfunc("MyAddition", .@a_val, .@b_val));
	mes("The result is "+.@var+".");
	close();
	// ...

function	script	MyAddition	{
	return getarg(0) + getarg(1);
}

Info

Assuming .@a_val and .@b_val being 1, both examples would yield a message displaying, that the result is 2.

	mes("Oh no...");
	close2();
	callsub(L_scream);
	end;
L_scream:
	npctalk("Iiiiiiiiiiiiieeeeeeeeeeeeeeeeeeeeeeeeek!!!");
	return;