<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.herc.ws/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Callfunc</id>
		<title>Callfunc - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Callfunc"/>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Callfunc&amp;action=history"/>
		<updated>2026-05-03T16:44:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.11</generator>

	<entry>
		<id>https://wiki.herc.ws/w/index.php?title=Callfunc&amp;diff=467&amp;oldid=prev</id>
		<title>Via: Created page with &quot;Category:Script_Command ==Syntax== * callfunc &quot;&lt;function&gt;&quot;{,&lt;argument&gt;,...&lt;argument&gt;}; * callfunc(&quot;&lt;function&gt;&quot;{,&lt;argument&gt;,...&lt;argument&gt;});  ==Description== This c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Callfunc&amp;diff=467&amp;oldid=prev"/>
				<updated>2013-06-09T09:40:29Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/wiki/Category:Script_Command&quot; title=&quot;Category:Script Command&quot;&gt;Category:Script_Command&lt;/a&gt; ==Syntax== * &lt;a href=&quot;/wiki/Callfunc&quot; title=&quot;Callfunc&quot;&gt;callfunc&lt;/a&gt; &amp;quot;&amp;lt;function&amp;gt;&amp;quot;{,&amp;lt;argument&amp;gt;,...&amp;lt;argument&amp;gt;}; * &lt;a href=&quot;/wiki/Callfunc&quot; title=&quot;Callfunc&quot;&gt;callfunc&lt;/a&gt;(&amp;quot;&amp;lt;function&amp;gt;&amp;quot;{,&amp;lt;argument&amp;gt;,...&amp;lt;argument&amp;gt;});  ==Description== This c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Script_Command]]&lt;br /&gt;
==Syntax==&lt;br /&gt;
* [[callfunc]] &amp;quot;&amp;lt;function&amp;gt;&amp;quot;{,&amp;lt;argument&amp;gt;,...&amp;lt;argument&amp;gt;};&lt;br /&gt;
* [[callfunc]](&amp;quot;&amp;lt;function&amp;gt;&amp;quot;{,&amp;lt;argument&amp;gt;,...&amp;lt;argument&amp;gt;});&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
This command lets you call up a function NPC. A function NPC can be called from &lt;br /&gt;
any script on any map server. Using the 'return' command it will come back to &lt;br /&gt;
the place that called it.&lt;br /&gt;
&lt;br /&gt;
You can pass arguments to your function - values telling it what exactly to do -&lt;br /&gt;
which will be available there with getarg() (see 'getarg')&lt;br /&gt;
Notice that returning is not mandatory, you can end execution right there.&lt;br /&gt;
&lt;br /&gt;
If you want to return a real value from inside your function NPC, it is better &lt;br /&gt;
to write it in the function form, which will also work and will make the script &lt;br /&gt;
generally cleaner.&lt;br /&gt;
==Examples==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	place,50,50,6%TAB%script%TAB%Woman%TAB%115,{&lt;br /&gt;
		mes &amp;quot;[Woman]&amp;quot;&lt;br /&gt;
		mes &amp;quot;Lets see if you win&amp;quot;;&lt;br /&gt;
		callfunc &amp;quot;funcNPC&amp;quot;;&lt;br /&gt;
		mes &amp;quot;Well done you have won&amp;quot;;&lt;br /&gt;
		close;&lt;br /&gt;
	}&lt;br /&gt;
	function%TAB%script%TAB%funcNPC%TAB%{&lt;br /&gt;
		if(rand(2)) return;&lt;br /&gt;
		mes &amp;quot;Sorry you lost&amp;quot;;&lt;br /&gt;
		end;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	place,50,50,6%TAB%script%TAB%Man%TAB%115,{&lt;br /&gt;
		mes &amp;quot;[Man]&amp;quot;&lt;br /&gt;
		mes &amp;quot;Gimme a number!&amp;quot;;&lt;br /&gt;
		next;&lt;br /&gt;
		input .@number;&lt;br /&gt;
		if (callfunc(&amp;quot;OddFunc&amp;quot;,.@number)) mes &amp;quot;It's odd!&amp;quot;;&lt;br /&gt;
		else mes &amp;quot;It's even&amp;quot;;&lt;br /&gt;
		close;&lt;br /&gt;
	}&lt;br /&gt;
	function%TAB%script%TAB%OddFunc%TAB%{&lt;br /&gt;
		if (getarg(0)%2) return 1; // it's odd&lt;br /&gt;
		return 0; // it's even&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Via</name></author>	</entry>

	</feed>