Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2008, 08:25 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I usually catchevent my gui catchs with something like guiDoStuff(); (a gui header rather then an on header) as I see them as a little different. That's just my opinion though but I don't want to see that functionality removed.
__________________
Do it with a DON!
Reply With Quote
  #2  
Old 05-03-2008, 02:58 PM
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 zokemon View Post
I usually catchevent my gui catchs with something like guiDoStuff(); (a gui header rather then an on header) as I see them as a little different. That's just my opinion though but I don't want to see that functionality removed.
Agreed, also if the "on" was removed, then it would break a ton of scripts.
__________________
Reply With Quote
  #3  
Old 05-03-2008, 10:29 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 cbkbud View Post
Agreed, also if the "on" was removed, then it would break a ton of scripts.
Quote:
Originally Posted by Stefan
You also don't need to specify the "on" in the event name, it's actually stripping that from the event name in case you are providing it.
Quote:
Originally Posted by Stefan
The only problem with catchevent() is that you cannot catch events for objects which don't have a name.
In my throwevent() example the first parameter was the object name which could be this.name or anything else. If such a thing is abusable it could be made so if you use throwevent() then the object name has to be the name of the object calling it or a string thats not an object name already.
Quote:
Originally Posted by Stefan
The function for invoking/throwing events is trigger(), but it is currently restricted to avoid security problems
You should make the object and function that triggered/scheduled the event the first entry in the new callstack, just so you know what started the thread. Then the RC could just check to make sure itself or Graal started the thread and not another script.

Would that suffice?
Quote:
Originally Posted by Stefan
cannot catch events for objects which don't have a name.
Make it so catchevent can take either a string object name or an object variable. Then you can do your internal stuff to keep track of the object by its pointer instead of by its name.
Quote:
Originally Posted by Robin View Post
wouldn't you rather have:

PHP Code:
function onCreated() {
  
someGui.addEventListener(GuiEvent.CLOSE, function() {
    
event = new createEvent("nsDOMMyEvent");
    
event.initEvent("nsDOMMyEvent");
    
thiso.dispatchEvent(event);
  });
  
this.addEventListener("nsDOMMyEvent", function() {
    
player.chat ":P";
  });

I would.
That looks ugly and confusing because you're defining functions on the fly. Lets try to keep things consistent here in GScript?
PHP Code:
//ScriptA
function onCreated() {
  
this.catchevent(someGui"CloseQuery""SomeGuiCloseQuery");
}
function 
onSomeGuiCloseQuery() {
  
// fancy fade-out effect
  
this.throwevent(this.name"DidGuiClose"params...);
  
// throwevent() only does something if the event its throwing
  //   is being caught. Does not trigger()
}
//ScriptB
function onCreated() {
  
this.catchevent(ScriptA"DidGuiClose""ScriptADidGuiClose");
  
// should use same name if you don't give a new one
}
function 
onScriptADidGuiClose(params...) {
  
//stuff

Now that is much more like how its done already.
__________________

Last edited by Inverness; 05-03-2008 at 10:53 PM..
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 09:46 AM.


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