Search the Commands

Home  All  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z 

Details for command callfunc:
* callfunc "Function"{,"Argument",...,"Argument"};
This command lets you call up a function NPC. A function NPC can be called from
any script on any map server. Using the 'return' command it will come back to
the place that called it.

mes "[Woman]"
mes "Lets see if you win";
callfunc "funcNPC";
mes "Well done you have won";
set @win, rand(2);
if(@win==0) return;
mes "Sorry you lost";

You can pass arguments to your function - values telling it what exactly to do -
which will be available there with getarg() (see 'getarg')
Notice that returning is not mandatory, you can end execution right there.

If you want to return a real value from inside your function NPC, it is better
to write it in the function form, which will also work and will make the script
generally cleaner:

mes "[Man]"
mes "Gimme a number!";
input @number;
if (callfunc("OddFunc",@number)) mes "It's Odd!";
if (getarg(0)%2==0) goto ItsEven;
return (1);
return (0);

Valid XHTML 1.0 Strict Valid CSS!