PDA

View Full Version : clientside > serverside


xXziroXx
03-15-2007, 05:35 AM
What is the best / more efficent way of sending data from SERVERSIDE to CLIENTSIDE in a CLASS that is joined by a LOCAL NPC?

Gambet
03-15-2007, 05:51 AM
You can always use attr's which can be read on both the serverside and clientside.

napo_p2p
03-15-2007, 07:34 AM
You can always use attr's which can be read on both the serverside and clientside.

Yeah, I would go with attrs too.

Twinny
03-15-2007, 08:14 AM
A change in attrs don't give an event though. Depends what you need.

xXziroXx
03-15-2007, 03:50 PM
A change in attrs don't give an event though. Depends what you need.

*sits back and waits for an example to be posted by Twinny on ways to do it*

Inverness
03-15-2007, 11:22 PM
Why not trigger an action on the NPC's shape?

Kristi
03-16-2007, 03:32 AM
A change in attrs don't give an event though. Depends what you need.
If the script already has a clientside timeout, then its not an issue. Otherwise, triggerclient works pretty well for events.

If you dont need an event, then attrs are the way to go.

xXziroXx
03-17-2007, 05:25 AM
Script in level..


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


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.

Rapidwolve
03-17-2007, 05:28 AM
setshape(0, 48, 48); clientside // random numbers

Inverness
03-17-2007, 06:48 AM
Actions "clientside" and "serverside" only work in weapons.

Angel_Light
03-17-2007, 07:00 AM
I did one using a triggeraction through our main systems weapon.. So basically, I did a triggeraction to the weapon and then made the weapon trigger the other part of the class.

Chompy
03-17-2007, 12:58 PM
Script in level..


...


Script of interaction_shop..


...


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.

Does interaction_shop have a shape?

Also, when you do

for(class: this.interaction.modes)

it'll join two classes (interaction_shop and interaction_leave) as I see it (dunno if that what it is suppose to do..)

And have you tried:


function onActionGetData()
{
triggerAction(this.x, this.y, "clientside", "test");
}
instead of

function onActionGetData()
{
triggerAction(x, y, "clientside", "test");
}
?

xXziroXx
03-17-2007, 09:19 PM
Look, EVERYTHING WORKS PERFECTLY other then to return the data from serverside > clientside. In my knowledge, there has NEVER been possible to trigger any kind of actions from serverside > clientside - and everyone Ive asked about it has confirmed it.

I've settled with attr's for now, untill Stefan gets around and making it possible to send actions from serverside to clientside in local NPCs.