Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-15-2007, 05:35 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
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?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #2  
Old 03-15-2007, 05:51 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
You can always use attr's which can be read on both the serverside and clientside.
Reply With Quote
  #3  
Old 03-15-2007, 07:34 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Gambet View Post
You can always use attr's which can be read on both the serverside and clientside.
Yeah, I would go with attrs too.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 03-15-2007, 08:14 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
A change in attrs don't give an event though. Depends what you need.
Reply With Quote
  #5  
Old 03-15-2007, 03:50 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Twinny View Post
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*
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 03-15-2007, 11:22 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Why not trigger an action on the NPC's shape?
__________________
Reply With Quote
  #7  
Old 03-16-2007, 03:32 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Twinny View Post
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.
__________________
Reply With Quote
  #8  
Old 03-17-2007, 05:25 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 03-17-2007, 05:28 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
setshape(0, 48, 48); clientside // random numbers
Reply With Quote
  #10  
Old 03-17-2007, 06:48 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Actions "clientside" and "serverside" only work in weapons.
__________________
Reply With Quote
  #11  
Old 03-17-2007, 07:00 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
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.
__________________
Deep into the Darkness peering...
Reply With Quote
  #12  
Old 03-17-2007, 12:58 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by xXziroXx View Post
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");

?
__________________
Reply With Quote
  #13  
Old 03-17-2007, 09:19 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:29 PM.


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