Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   WeaponLoaded event (https://forums.graalonline.com/forums/showthread.php?t=59106)

Kaimetsu 05-25-2005 05:10 PM

WeaponLoaded event
 
It would be nice if the clientside portions of weapons received events anytime any other weapon was loaded. See, I have a weapon called Kai_Binds whose purpose is to filter keyboard events and then trigger other weapons. These weapons have to register interest with Kai_Binds in order to receive the events, and they do this by calling a public function. Thereafter, their details are stored in this.variables.

But if I edit the Kai_Binds' script while somebody is playing then suddenly the system breaks down. The this.variables are lost, so Kai_Binds doesn't know about the other weapons anymore. Even worse, those weapons don't know that it doesn't know about them, so they can't remind it. That's where my suggestion comes into play. If they were informed when Kai_Binds is reloaded, they could re-register and everything would be fine.

It could also be useful in, say, a custom Q-menu. Instead of constantly checking the player's weapon list, the menu could simply wait for a WeaponLoaded event and add the new weapon to the list.

The events could possibly be restricted to post-login weapon loads, to reduce overheads? Either way, I can't imagine it being too much effort to implement :)
ALSO, GIVE ME V4 ACCESS >:O

Velox Cruentus 05-25-2005 05:17 PM

v4 access has already too many people.

PHP Code:

function onCreated()
{
  for (
oweapons)
    
o.trigger("WeaponLoaded",this.name);


Magic.

Kaimetsu 05-25-2005 05:19 PM

Quote:

Originally Posted by Velox Cruentus
v4 access has already too many people

So kick out some of the dead weight :)

Quote:

PHP Code:

function onCreated()
{
  for (
oweapons)
    
o.trigger("WeaponLoaded",this.name);



Not exactly the most elegant solution, is it? For the Q-menu thing, you'd need to add that code to every weapon.

Velox Cruentus 05-25-2005 05:24 PM

PHP Code:

function onCreated()
{
  
this.join("thingseveryweaponshouldhave");


It can serve other purposes as well.

Not the most elegant solution, but a pretty nifty contour in the meanwhile.

Kaimetsu 05-25-2005 05:38 PM

Well, I agree that it's a suitable workaround, but it's nowhere near as convenient as the system I described.

I think the portability of scripts is gonna become an increasingly important factor as Graal develops. For example, people should be able to casually add standard, open-source Q-menu scripts to their servers without editing all of their weapons.


All times are GMT +2. The time now is 02:09 AM.

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