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-16-2005, 10:26 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Joining Classes

When you use the join() function to join a class, what is the precedence of event handlers? Can event handlers share the same events with the NPC?

ex.
let's say this is class "class":
function onCreated() {
setshape(1,32,32);
}

and call this an npc:
join("class");
function onCreated() {
setshape(1,64,64);
}

would the class event handler be called and then the npc event handler? Would they both have the capacity to be called? I'm just wondering because I just decided to propose an action handling structure for Classic, but it would probably encounter this a lot.
Reply With Quote
  #2  
Old 12-17-2005, 12:49 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
You can just test this yourself.
__________________
Reply With Quote
  #3  
Old 12-17-2005, 01:41 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
that doesn't mean there's more to it that I can't test for.
Reply With Quote
  #4  
Old 12-17-2005, 03:25 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by jake13jake
that doesn't mean there's more to it that I can't test for.
That made no sense whatsoever.
__________________
Reply With Quote
  #5  
Old 12-17-2005, 03:27 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by ZeLpH_MyStiK
That made no sense whatsoever.
Not really, I just hate the lack of commands documentation.
Reply With Quote
  #6  
Old 12-17-2005, 06:53 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by jake13jake
Not really, I just hate the lack of commands documentation.
Now that I agree with. However, you must keep in mind that GS2 is still under development and things are being changed around all the time, so it's kind of hard to make a documentation for it.
__________________
Reply With Quote
  #7  
Old 12-17-2005, 05:13 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The onCreated() part is called for each joined class, if you pre-join a class (put the join outside of any function) or you join a class in an onCreated() function.
Other events only choose the first event handler they find. That makes it possible to overwrite the event handler of a class. If you overwrite the event handler and want still that the original event handler is executed, call classname::function yourself, like
PHP Code:
function onCreated() {
  
join("myitems");
  
// no need to call myitems::onCreated() here since it is executed anyway
}
function 
onPlayerEnters() {
  echo(
"player enters!");
  
myitems::onPlayerEnters();

We should may be add a wiki page for the Graal script classes.
Reply With Quote
  #8  
Old 12-18-2005, 12:50 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Thank you Stefan <3!!!!!!!!
That's a lot more information than I thought was behind it.
Reply With Quote
  #9  
Old 12-18-2005, 06:24 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
:o Stefan supports the wiki?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #10  
Old 12-20-2005, 07:33 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes I have added a lot of text there, but someone needs to remind Loriel to change the licensing thing
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:01 AM.


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