Brian Posted August 6, 2012 Posted August 6, 2012 Test("Hello !"); To call functions like that, you have to define the function within the npc object, not as a separate object. There's an example in trunk/doc/script_commands.txt prontera,150,150,0 script TestNPC 123,{ function MyAdd; mes "Enter two numbers."; next; input .@a; input .@b; mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@; close; function MyAdd { return getarg(0)+getarg(1); } }
Swadon Posted August 6, 2012 Posted August 6, 2012 It works with a separate object since the revision r15979 Added support for scripts to call user-defined functions without the use of callfunc The scripting engine now supports both the direct invocation of user-defined functions (r15979 and r15981)
Ind Posted August 12, 2012 Posted August 12, 2012 Another bugfix in r16625 regarding this feature, at this point I come to think this feature might be fully functional now. 1
Aries Posted August 28, 2012 Posted August 28, 2012 (edited) As of r15982, variables used within scripts can be directly assigned to as you would using another programming language. this will only work with varialbles and not yet with arrays? Edited August 28, 2012 by chokoleyt
Emistry Posted August 28, 2012 Posted August 28, 2012 yes variable only......doesnt support for passing an arrays into the function.... but there is still alot way for you to pass the value of an array into the function....
Recommended Posts