PHP Code:
triggeraction(x,y,"name",param0,param1,...);
Triggeraction is used to interact between NPCs, by... triggering them, at the x/y coordinate given.
Say you have a weapon called a Hammer:
PHP Code:
function onWeaponfired() {
triggeraction(player.x+vecx(player.dir)*2,player.y+vecx(player.dir)*2,"Hammer",client.hammerstr);
}
That weapon sends a trigger at the coordinates in front of the player's current direction. The trigger is given the name "Hammer", sent with the parameter of the players hammer strength(if defined of course). Multiple parameters can be given. Then you have... let's say, a rock:
PHP Code:
function onactionHammer() {
this.chat="Your hammer is level" @ params[0] @ "!";
}
The rock will tell you what level your hammer is when it's hit. So in order to grab the trigger being sent, you use onactionTRIGGERNAME(), and you can do with it and the parameters as you wish.
Triggeraction can also communicate between the clientside and serverside, but I recommend triggerserver/triggerclient. Mainly because they're made specifically for that, and triggeraction was only used because it was the only available method. They do the same thing anyways, and since you're now learning, it's not like you're going to have to break the habit.