Quote:
Originally Posted by Inverness
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 newFunc( indx ) {
new GuiButtonCtrl( "TestButton_" @ indx ) {
profile = GuiBlueButtonProfile;
height = 22;
width = 67;
text = "Test Button!";
x = 50;
y = 50;
thiso.catchevent( this.name , "Action", "ButtonReceive" );
}
}
function onButtonReceive( objectname ) {
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.