Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-01-2009, 11:40 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Global Trigger

Is it possible to trigger an event and it be picked up by every script on the client or server, depending on which you use it on?

Would be very useful to me.
Reply With Quote
  #2  
Old 12-02-2009, 12:21 AM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
There's been several different ways through and around this...one of the most effective I think is Inver's "bind()" functions. It's on the server. I'm using it.
__________________
Stan.
Reply With Quote
  #3  
Old 12-02-2009, 12:28 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 Codein View Post
Is it possible to trigger an event and it be picked up by every script on the client or server, depending on which you use it on?

Would be very useful to me.
Unfortunately, no, though it would be very useful and would be a nice addition to the scripting language.

You can, however, do stuff like

PHP Code:
temp.importantDatabases = {(@ "Control-NPC"), DB_PlayerStatsDB_Bank};
temp.lists = {this.level.npcsplayer.weaponsimporantDatabases};

for (
temp. list : lists) {
  for (
temp.obj : list) {
    
obj.trigger("myFunction""...");
  }

for most cases
__________________
Reply With Quote
  #4  
Old 12-02-2009, 12:41 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by cbk1994 View Post
Unfortunately, no, though it would be very useful and would be a nice addition to the scripting language.

You can, however, do stuff like

PHP Code:
temp.importantDatabases = {(@ "Control-NPC"), DB_PlayerStatsDB_Bank};
temp.lists = {this.level.npcsplayer.weaponsimporantDatabases};

for (
temp. list : lists) {
  for (
temp.obj : list) {
    
obj.trigger("myFunction""...");
  }

for most cases
I'll probably whip something up. It'll be a bit more complex because I need it the object list to dependent on what ever is in the Weapons/NPCs lists, and update automatically when weapons are added and removed (for server triggers).

I could scan the weapons/* folder, but that'd be so insecure.

Another possibility is a global register of weapons and NPCs and that a requirement is to have a class joined to every created weapon/npc.

Either way isn't a totally ideal solution. I'll just experiment.
Reply With Quote
  #5  
Old 12-02-2009, 12:43 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Codein View Post
I could scan the weapons/* folder, but that'd be so insecure.
Loadfolder works fine without the NPC-Server having r rights
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #6  
Old 12-02-2009, 12:46 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Tigairius View Post
Loadfolder works fine without the NPC-Server having r rights
Thank you so much.
Reply With Quote
  #7  
Old 12-02-2009, 01:44 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
What could be so important that you'd need to tell all your scripts about it?
__________________
Quote:
Reply With Quote
  #8  
Old 12-02-2009, 02:04 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 fowlplay4 View Post
What could be so important that you'd need to tell all your scripts about it?
A quick example off the top of my head would be when a player dies. For example, the gang database NPC then checks if the player was on a gang tag and if they need to lose points, the spar system checks if the player was sparring to warp them out, similar with events, etc.
__________________
Reply With Quote
  #9  
Old 12-02-2009, 02:06 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by fowlplay4 View Post
What could be so important that you'd need to tell all your scripts about it?
Guild name changes
Some variables like rupees and health
Etc.

Those examples are mainly for servers which already set player.rupees and player.guild directly without an interface would benefit greatly, instead of going through all scripts and replacing them with the appropriate method call.
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 07:35 AM.


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