Skip to content
Haru edited this page Oct 19, 2016 · 1 revision

Category:Script_Command

Syntax

  • callsub <label></label>{,<argument></argument>,...<argument></argument>};

Description

This command will go to a specified label within the current script (do NOT use quotes around it) coming in as if it were a 'callfunc' call, and pass it arguments given, if any, which can be recovered there with 'getarg'. When done there, you should use the 'return' command to go back to the point from where this label was called. This is used when there is a specific thing the script will do over and over, this lets you use the same bit of code as many times as you like, to save space and time, without creating extra NPC objects which are needed with 'callfunc'. A label is not callable in this manner from another script.

Examples

		mes &amp;amp&#59;quot&amp;&#35;59&#59;&amp;amp&#59;&amp;&#35;35&#59;91&amp;&#35;59&#59;Woman&amp;amp&#59;&amp;&#35;35&#59;93&amp;&#35;59&#59;&amp;amp&#59;quot&amp;&#35;59&#59;&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		mes &amp;amp&#59;quot&amp;&#35;59&#59;Lets see if you win&amp;amp&#59;quot&amp;&#35;59&#59;&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		callsub Check,2&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		mes &amp;amp&#59;quot&amp;&#35;59&#59;Well done you have won&amp;amp&#59;quot&amp;&#35;59&#59;&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		close&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
	Check&amp;amp&#59;&amp;&#35;35&#59;58&amp;&#35;59&#59;
		if(&amp;amp&#59;&amp;&#35;35&#59;33&amp;&#35;59&#59;rand(getarg(0))) return&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		mes &amp;amp&#59;quot&amp;&#35;59&#59;Sorry you lost&amp;amp&#59;quot&amp;&#35;59&#59;&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
		close&amp;amp&#59;&amp;&#35;35&#59;59&amp;&#35;59&#59;
Clone this wiki locally