Script in level..
PHP Code:
NPC - 30 30
function onCreated()
{
setshape( 1, 32, 32 );
ani = "idle";
this.join("addon_interaction");
}
function onActionAddClass() this.join("interaction_" @ params[0].lower());
//#CLIENTSIDE
function onCreated()
{
// Initialize the attributes
showcharacter();
headimg = "head0.png";
colors[0] = "orange";
colors[1] = "white";
colors[2] = "blue";
colors[3] = "red";
colors[4] = "black";
shieldimg = "shield1.gif";
dir = 2;
chat = "Shop";
nick = "Fred";
this.interaction = new TStaticVar();
this.interaction.say = "Hello, what can I do for you?";
this.interaction.modes = { "Shop", "Leave" };
this.shop = new TStaticVar();
this.shop.class = "fredshop";
for (class: this.interaction.modes) triggerAction(this.x, this.y, "addClass", class);
}
NPCEND
Script of interaction_shop..
PHP Code:
function onActionGetData()
{
triggerAction(x, y, "clientside", "test");
}
//#CLIENTSIDE
function interactionShop()
{
Interaction_Menu.visible = false;
triggerAction(this.x, this.y, "GetData", "");
}
function onActionClientSide()
{
chat = "!";
}
The addon_interaction class calls the function "interactionShop" when the npc is clicked, and so far so good.. the action "GetData" is sent by the interaction _shop class BUT I cant send the data back from serverside to clientside no mather how I try..
I would preffer solving it with actions or something, I'd hate to have to use a timeout and attr's.