Quote:
|
Originally Posted by wild8900
Thanks  , aside from a few syntax errors (easy to solve), they worked good!
So, how do these actions work? Whats this #p(0)-4?
|
#p(#) (GS1) and params[#] (GS2) are for transfering information from the client -> server.
Here's a GS1 example:
NPC Code:
if (created) setshape 1, 32, 32;
if (actiontest) {
message You said #p(0)!;
}
//#CLIENTSIDE
if (playerchats) {
triggeraction x, y, test, #c;
}
Look in the triggeraction. #c is param 0, or #p(0). One thing you should know is that most things start with a value of 0. These include tokenizing, arrays, etc...
Anyway, param 0 is #c, or the player's chat. It's transfering what the player sayed in the action. So, when the action is recieved on the serverside, it's telling you param 0, or #p(0).
Triggeractions also need a surface to trigger. This can either be a non-transparent surface of an image or a setshape.
Here's an example of how this would work in GS2.
NPC Code:
function onCreated()
setshape(1, 32, 32);
function onActionTest()
message("You said" SPC params[0] @ "!");
//#CLIENTSIDE
function onPlayerChats()
triggerAction(x, y, "test", player.chat);
Not too much different.