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 02-12-2009, 01:41 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Passing values from Clientside to Serverside

Ookay, I had higher hopes for the Stickies, but given that the optimization guide was written in 2004, I guess I'm out of luck:

Are we seriously still using triggeraction to send data from Clientside to Serverside? And are we seriously still using this.rupees, this.darts, this.hearts to change values on Serverside that Clientside can pick up on? I found triggerserver, and that's great for weapons, but I mean - seriously? Are we still tying "the player just hit me" to a code-arrow, shooting it at the serverside, and praying it hits?! I mean, I'm the first to admit I been out of the game for a while, but if there's a better way I'd love to know what it is...

And for those of you who absolutely have to know the context, I'm making a baddy, okay? And right now one baddy runs trigger-to-trigger on the serverside (move to onMovementfinished - and once again, hoorah for a language that buries that tidbit in the newfeatures2001.txt), then looks for an enemy; the clientside looks for an enemy to turn the baddy's head; and the gani runs a timeout too, because it's complicated, (and I'm probably gonna wind up scrapping the gani and moving all that code right back to the clientside script). And right now the only way to tell the Client that the baddy's taken damage is to set this.hearts, and have the client scan it every 0.05 seconds. -_-
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #2  
Old 02-12-2009, 02:08 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Tyhm View Post
Are we seriously still using triggeraction to send data from Clientside to Serverside?
Yes. You can use triggeractions (triggerclient, triggerserver) or you can send data (albeit without events) using client flags or player attrs.
Quote:
Originally Posted by Tyhm
And are we seriously still using this.rupees, this.darts, this.hearts to change values on Serverside that Clientside can pick up on?
What do you mean? When you change these values serverside, they update clientside also.
Quote:
Originally Posted by Tyhm
I found triggerserver, and that's great for weapons, but I mean - seriously? Are we still tying "the player just hit me" to a code-arrow, shooting it at the serverside, and praying it hits?!
I'm not sure what you are even getting at here.
Quote:
Originally Posted by Tyhm
And right now the only way to tell the Client that the baddy's taken damage is to set this.hearts, and have the client scan it every 0.05 seconds. -_-
To be honest, I'm not sure what you were expecting. You could quite easily send a triggeraction to the clientside each time the baddy takes damage but this is exactly the sort of thing you have to do when you involve a server and a client in any application, not just Graal: either poll for changes or wait for events.
Reply With Quote
  #3  
Old 02-12-2009, 02:23 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
I think what Tyhm is looking for here is triggering the "other" side of the script without involving coordinates or the chance that other scripts might be hit by it.
Reply With Quote
  #4  
Old 02-12-2009, 02:23 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
My point is triggerserver/triggerclient seems to be weapons only, edit rupees/hearts/etc seems to be the only set of variables that ARE visible to Client when they're changed on Server. And clientr. are really playerr, apparently....

And yes, callclient(parameters) would be awesome.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #5  
Old 02-12-2009, 02:24 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Tyhm View Post
rupees/hearts/etc seems to be the only set of variables that ARE visible to Client when they're changed on Server.
Did we not have a bunch of save[i] variables with limited range or something that worked like that too?
Reply With Quote
  #6  
Old 02-12-2009, 02:37 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Ha, yeah, [0]-[9] and 0-220 I think. And bombs and darts (0-99), and probably swordpower and shieldpower, and I can always shoehorn a meaningful #P1 into a gani without a hat to sneak another string in that way; I'd just rather not if there's a better way.

Apparently there is not. -_-

Yet; I fully expect that as soon as I've gone to the trouble something will be released that makes my work unnecessary again...
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #7  
Old 02-12-2009, 04:35 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
Quote:
Originally Posted by Loriel View Post
I think what Tyhm is looking for here is triggering the "other" side of the script without involving coordinates or the chance that other scripts might be hit by it.
If you have an NPC's ID and level name, you can send it to a triggerserver/client and simply use functions to locate the NPC object.

These are two functions extracted from my triggercontrol class that is used to wrap the triggerserver() and triggerclient() in weapons:
PHP Code:
public function npcfunction(lvlnamenpcidfuncnamep3p4p5p6p7p8p9) {
  for (
temp.ifindlevel(temp.lvlname).npcs) {
    if (
temp.i.id == temp.npcid) {
      return 
temp.i.(@ temp.funcname)(temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);
    }
  }
}
//#CLIENTSIDE
public function npcfunction(npcidfuncnamep2p3p4p5p6p7p8p9) {
  return 
findnpcbyid(temp.npcid).(@ temp.funcname)(temp.p2temp.p3temp.p4temp.p5temp.p6temp.p7temp.p8temp.p9);

Call clientside part of an NPC from serverside, assuming I have a calling player, I can:

WeaponName.ClientFunction(null, "npcfunction", this.id, "saystuff", "lol I like pancakes");

Or from the client:

WeaponName.ServerFunction(null, "npcfunction", this.level.name, this.id, "saystuff", "Inverness was here");


Note that ClientFunction() and ServerFunction() are part of my class, they call a function on the other side and wait for return value. Naturally, I would prefer a hard-coded function, as it would be more efficient.
__________________
Reply With Quote
  #8  
Old 02-13-2009, 02:48 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Huh?
Yeah, but triggerserver and triggerclient are NPCW only, right?
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #9  
Old 02-13-2009, 04:06 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tyhm View Post
Huh?
Yeah, but triggerserver and triggerclient are NPCW only, right?
You can use

PHP Code:
triggerserver("gui""blah");
triggerserver("weapon""blah"); // same as gui
triggerserver("npc""blah"); 
For NPCs, you can do:

PHP Code:
findNPC(npc).trigger("ActionServerside""foo"); 
(though you can use something else as well).
__________________
Reply With Quote
  #10  
Old 02-13-2009, 05:41 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Thanks. Godforbid the wiki be up to date...-_-
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
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 12:24 PM.


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