Jump to content

r15982: Script Engine Update


Panallox

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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);
}
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  17
  • Reputation:   4
  • Joined:  01/07/12
  • Last Seen:  

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)
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

oops, seems I'm a little behind XD

Thanks Swadon!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

Another bugfix in r16625 regarding this feature, at this point I come to think this feature might be fully functional now.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  56
  • Reputation:   30
  • Joined:  02/22/12
  • Last Seen:  

<3

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  70
  • Reputation:   18
  • Joined:  01/28/12
  • Last Seen:  

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 by chokoleyt
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

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....

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...