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 03-17-2007, 06:51 AM
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
How to trigger same function accross multiple classes?

For the new mud system I'm working on its imperative that I be able to trigger same the function across multiple classes, preferably in the order the classes are joined to the object.

For example, I have Object, and I join ClassA and ClassB to Object, I must have a way of triggering the Created event in ClassA then ClassB as they have their own things that need to be done.
__________________
Reply With Quote
  #2  
Old 03-17-2007, 06:56 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
I had to do this awhile back and Hikaru helped me with it
I'd Put this in a class and made the other class trigger each other.

PHP Code:
this.join("class");
class::
FunctionInClass(); 
I did the above on serverside so I'm not sure if it would work on the clientside part of the class.
Then whenever I need the function I can simply use the function

PHP Code:
FunctionInClassvar1var2); 
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 03-17-2007, 07:14 AM
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
Bah, when I tried that the first time I never worked, and now it magically does, how irritating.
__________________
Reply With Quote
  #4  
Old 03-17-2007, 07:16 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Heh, well glad to see it's working for you. ^_^
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 03-17-2007, 07:25 AM
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
I have problem now, how to make it so it only calls the function in the object and not classes?
__________________
Reply With Quote
  #6  
Old 03-17-2007, 07:32 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
can you attach vars to the function and if whatever var equals foo it calls in that area specifically?
__________________
Deep into the Darkness peering...
Reply With Quote
  #7  
Old 03-17-2007, 10:37 AM
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
...
Why didn't I think of that >_>
That is good idea, but I was hoping to not have to do that

I suppose what I'll do is have the functions named differently for each class, like <classname>_onCreated() and then this_onCreated() for the base object or something, it would be about the same as doing classname::functionname() and I'll just make a function to call each of those.

We'd have the normal onCreated() event block that would have triggerall("Created", params) that would trigger the blocks that actually do something, starting with the this_onCreated() event and moving through class list.

So any time a normal event is triggered it would trigger the 'multi-event' as a result.
__________________
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 10:48 AM.


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