Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-02-2010, 07:13 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Triggering a gui control?

I have a GUI controll, his name is Jerry.

Say hi to jerry:
PHP Code:
new GuiControl("Jerry") {
  
0;
  
width height 32;
  
  
thiso.catchevent(this"onAction""DoStuff");

I need to trigger that onAction() function, but not by clicking the control.

I need something along the lines of
PHP Code:
Jerry.onAction() 
But that particular script, does not work.

Neight does Jerry.trigger("Action"); or any variation of that.

Any solutions?

(Note: I need this type of script, not other variations...I can't trigger DoStuff by itself, because I need information from inside that gui control. And in my actual script, I have a multitude of controls like Jerry, but they are dynamically generated. Which is why I need this particular script)
__________________

Reply With Quote
  #2  
Old 12-02-2010, 07:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You're already redirecting the event to DoStuff so just make DoStuff public and call it with:

findweapon("-WhereverItIs").DoStuff(Jerry);

You actually don't have to pass Jerry at all but that would mimic the same params as it would receive normally.
__________________
Quote:
Reply With Quote
  #3  
Old 12-02-2010, 07:18 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Well, I have different types of gui controls.

Some of which have different functions...which is why I was hoping I could trigger the gui control itself.

Because one might trigger 'DoStuff' while the other could trigger 'DoOtherStuff'.

Which is why I was hoping for something along the lines of triggering the gui control....would make like much easier.


Edit: I solved the problem by just using a dynamic function, and storing the function that the gui should trigger within the gui control itself. :P
__________________

Reply With Quote
  #4  
Old 12-02-2010, 07:27 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Well just make a central function that they all use and call the right function based on the object passed.

Usage:

findweapon("-GUI").triggerGUI(Jerry);

PHP Code:
public function triggerGUI(obj) {
  if (
obj == Jerry) {
    
DoStuff();
  } else {
    
DoOtherStuff();
  }

__________________
Quote:
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 05:06 PM.


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