View Single Post
  #5  
Old 07-20-2008, 07:29 AM
The_Kez The_Kez is offline
N-Pulse Asst. Manager
The_Kez's Avatar
Join Date: Dec 2007
Posts: 106
The_Kez is on a distinguished road
Send a message via MSN to The_Kez
Unhappy

Quote:
Originally Posted by Inverness View Post
That's what catchevent() is for.

objectA.catchevent(objectBName, eventNameToCatch, newEventName);
PHP Code:
function blah() {
  new 
GuiButtonCtrl("SpecialButton" number) {
    
//stuff
    
thiso.catchevent(this.name"Action""ButtonAction");
  }
}
function 
onButtonAction(objectname) {
  echo(
"Button Action from " objectname);

The new event will always have the name of the object you're catching from as the first parameter.
I've also been curious about this for awhile. I understand the concept of how this would work, but when I create a test script to see if it actually works out it doesn't seem to produce anything. Right now I have:

PHP Code:
function newFuncindx ) {
  new 
GuiButtonCtrl"TestButton_" indx ) {
      
profile GuiBlueButtonProfile;
      
height 22;
      
width 67;
      
text "Test Button!";
      
50;
      
50;
      
thiso.catcheventthis.name "Action""ButtonReceive" );
  }
}
function 
onButtonReceiveobjectname ) {
  
player.chat objectname " has triggered this event!";

The ButtonReceive event isn't triggered at all. With 'objectname' am I supposed to just be parsing parameters like that or do I actually need to place a specific object name in there? Otherwise I'm not sure what I'm doing wrong.
Reply With Quote