Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Global Trigger (https://forums.graalonline.com/forums/showthread.php?t=134257155)

Codein 12-01-2009 11:40 PM

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.

Kyranki 12-02-2009 12:21 AM

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. :p I'm using it.

cbk1994 12-02-2009 12:28 AM

Quote:

Originally Posted by Codein (Post 1541787)
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

Codein 12-02-2009 12:41 AM

Quote:

Originally Posted by cbk1994 (Post 1541804)
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.

Tigairius 12-02-2009 12:43 AM

Quote:

Originally Posted by Codein (Post 1541809)
I could scan the weapons/* folder, but that'd be so insecure.

Loadfolder works fine without the NPC-Server having r rights :)

Codein 12-02-2009 12:46 AM

Quote:

Originally Posted by Tigairius (Post 1541810)
Loadfolder works fine without the NPC-Server having r rights :)

Thank you so much.

fowlplay4 12-02-2009 01:44 AM

What could be so important that you'd need to tell all your scripts about it?

cbk1994 12-02-2009 02:04 AM

Quote:

Originally Posted by fowlplay4 (Post 1541827)
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.

Codein 12-02-2009 02:06 AM

Quote:

Originally Posted by fowlplay4 (Post 1541827)
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.


All times are GMT +2. The time now is 08:33 AM.

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