Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   clientside > serverside (https://forums.graalonline.com/forums/showthread.php?t=72842)

xXziroXx 03-15-2007 05:35 AM

clientside > serverside
 
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

Quote:

Originally Posted by Gambet (Post 1288790)
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

Quote:

Originally Posted by Twinny (Post 1288832)
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

Quote:

Originally Posted by Twinny (Post 1288832)
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..

PHP Code:

NPC 30 30
function onCreated()
{
  
setshape13232 );
  
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.modestriggerAction(this.xthis.y"addClass", class);
}
NPCEND 

Script of interaction_shop..

PHP Code:

function onActionGetData()
{
  
triggerAction(xy"clientside""test");
}

//#CLIENTSIDE
function interactionShop()
{
  
Interaction_Menu.visible false;
  
triggerAction(this.xthis.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

Quote:

Originally Posted by xXziroXx (Post 1289381)
Script in level..

PHP Code:

... 

Script of interaction_shop..

PHP Code:

... 

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:

PHP Code:

function onActionGetData()
{
  
triggerAction(this.xthis.y"clientside""test");


instead of
PHP Code:

function onActionGetData()
{
  
triggerAction(xy"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.


All times are GMT +2. The time now is 10:06 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.