DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • September 05, 2010, 08:12:24 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: dohook did not return an array for modulehook  (Read 1873 times)
0 Members and 1 Guest are viewing this topic.
Dannic
Guest
« on: April 02, 2005, 12:20:15 PM »

Is there an example of how to incorportate module hooks in other modules?  I have tons of these errors with many of the modules loaded.
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: April 02, 2005, 12:25:08 PM »

Well, I have one in the library, and it is not erroring. What people try to do, is copy over a hook, not knowing what it does.

A simple:
Code:
modulehook("foobar");
Will work.

The errors arise, becuase people don't understand the links, so they will copy over:
Code:
modulehook("foobar",array());
Now knowing what it does, and then never passing things through. Thus, you get errors.
« Last Edit: April 02, 2005, 12:25:25 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #2 on: April 02, 2005, 03:35:44 PM »

Whoa sichae, you're off on a tangent.

When you run
Code:
modulehook("foobar")
, that is identical to running
Code:
modulehook("foobar", array())
.

You can pass ANY array of values down any module hook..  What the CODE does on a modulehook is.

It takes the incoming arguments as an array, and gets a list of all modules which care about that hook in order  Now, it passes the initial argument list to the first module which cares, and assigns the result back to that same variable which it then passes to the next module, etc.

this has nothing AT ALL to do with calling a modulehook within your own module.
Logged

Ex co-developer of LotGD
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #3 on: April 02, 2005, 05:06:30 PM »

Whoa Sichae, you're off on a tangent.

Aren't I always? hehe.

I was actually thinking about it, on the way back from dinner. Then decided, that it doesn't matter if array() is in there or not, since there is nothing in the array, it is basically null value.
« Last Edit: April 02, 2005, 05:07:15 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Dannic
Guest
« Reply #4 on: April 02, 2005, 08:04:55 PM »

Alright.  so is there an example?

After looking at the errors they mostly seem to be about the specialties which are calling the modulehook in castlelib of lonny's castle.

Logged
Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #5 on: April 02, 2005, 08:19:52 PM »

What are you wanting an example of dannic?
Logged

Ex co-developer of LotGD
Dannic
Guest
« Reply #6 on: April 02, 2005, 08:29:14 PM »

a good place to look to get rid of the error.  Basicly how to return the proper values for the modulehook in my modules.

Code:
<b>specialtytacticsskills_dohook</b> did not return an array in the module <b>specialtytacticsskills</b> for hook <b>castlelibbook</b>. in /home/public_html/logd/lib/modules.php (509)

There is obviously something missing but since return $args; doesn't cover it what will?

Or even just point me towards a module that does basicly the same thing would probably be more effective right at the moment.
Logged
Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #7 on: April 02, 2005, 08:35:06 PM »

a good place to look to get rid of the error.  Basicly how to return the proper values for the modulehook in my modules.

Code:
<b>specialtytacticsskills_dohook</b> did not return an array in the module <b>specialtytacticsskills</b> for hook <b>castlelibbook</b>. in /home/public_html/logd/lib/modules.php (509)

There is obviously something missing but since return $args; doesn't cover it what will?

Or even just point me towards a module that does basicly the same thing would probably be more effective right at the moment.
dannic,

What this error is saying is that the module module/specialtytacticsskills.php does not have a return $args when it executed the code for case 'castlelibbook'.

The easiest way to fix this, is, as the last line of specialtytacticsskills_d ohook, right before the closed }, put in return $args;

I guarentee you that will fix the problem.  If you believe you have done that, then I guarentee that you put the return $args in the wrong place and you need to go back and fix it.  Pretty much every core module has this, but there is no 'magic' here.
Logged

Ex co-developer of LotGD
Dannic
Guest
« Reply #8 on: April 02, 2005, 08:39:44 PM »

I believe you but I have looked at the 6 modules involved and they all have the return $args; before the last } of the dohook function.

This is why I asked for help because I can't figure out why it is doing that.  I have fixed all the other modules I have that way but these seem to cause me issues since they actually call modulehooks in other modules and not the core code.

These are all modulehooks in other modules.

Well, except for the faqaddon module I made.  That one actually uses the faq_toc case.  Even it has the return $args; in the proper place.
« Last Edit: April 02, 2005, 08:40:42 PM by Dannic » Logged
Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #9 on: April 02, 2005, 08:43:46 PM »

Whether the modulehook is in the module or in the core code does not matter.

Look at the file that the error message told you contained the error.
(modules/specialtytacticsskills.php)

I promise you, *that* is what contains the error in it's dohook function.

If you don't believe me, send me the file and I'll prove it to you.
Logged

Ex co-developer of LotGD
Dannic
Guest
« Reply #10 on: April 02, 2005, 08:46:47 PM »

here is the function dohook for emoticons

Code:
function emoticons_dohook($hookname,$args){
   global $session;
   switch($hookname){
   
      case "faq-toc":
         $t = translate_inline("`@Frequently Asked Questions on Emoticons`0");
         output_notl("&#149;<a href='runmodule.php?module=emoticons&op=faq'>$t</a><br/>", true);
         break;
         
      case "commentarytrail":
         if (get_module_pref('user_display')){
         output("`n`2-=-=Clickable Smilies=-=-`n");
            rawoutput("<a onClick=\"addSmiley(' *frown* ')\"><img src='./images/frown.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *grin* ')\"><img src='./images/grin.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *lol* ')\"><img src='./images/lol.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *angry* ')\"><img src='./images/mad.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *red* ')\"><img src='./images/redface.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *rolleyes* ')\"><img src='./images/rolleyes.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *shocked* ')\"><img src='./images/shocked.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *tongue* ')\"><img src='./images/tongue.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *wink* ')\"><img src='./images/wink.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *confused* ')\"><img src='./images/confused.gif'></a> ");
            rawoutput("<a onClick=\"addSmiley(' *cry* ')\"><img src='./images/cry.gif'></a> ");
          rawoutput("<script language=\"JavaScript\" type=\"text/javascript\">\n");
          rawoutput("function addSmiley(textToAdd)\n");
          rawoutput("{\n");
          rawoutput("document.talkform.commentary.value += textToAdd;");
          rawoutput("document.talkform.commentary.focus();\n");
          rawoutput("}\n");
          rawoutput("</script>\n");
          }
         break;
         
      case "viewcommentary":
         if (get_module_pref('user_display')){
         $args = str_replace("*frown*","<IMG SRC=\"./images/frown.gif\">",$args);
         $args = str_replace("*grin*","<IMG SRC=\"./images/grin.gif\">",$args);
         $args = str_replace("*lol*","<IMG SRC=\"./images/lol.gif\">",$args);
         $args = str_replace("*angry*","<IMG SRC=\"./images/mad.gif\">",$args);
         $args = str_replace("*red*","<IMG SRC=\"./images/redface.gif\">",$args);
         $args = str_replace("*rolleyes*","<IMG SRC=\"./images/rolleyes.gif\">",$args);
         $args = str_replace("*shocked*","<IMG SRC=\"./images/shocked.gif\">",$args);
         $args = str_replace("*tongue*","<IMG SRC=\"./images/tongue.gif\">",$args);
         $args = str_replace("*wink*","<IMG SRC=\"./images/wink.gif\">",$args);
         $args = str_replace("*confused*","<IMG SRC=\"./images/confused.gif\">",$args);
         $args = str_replace("*cry*","<IMG SRC=\"./images/cry.gif\">",$args);
         return $args;
         }
         break;
   }
   return $args;
}

Is the return $args; in the wrong place?  This one gives me the error and it just happens to be the shortest one to post.  I can send you the files if you like if that would be easier.  Though probably one would do it.

I get the error on fac_toc for this one.
Logged
Kendaer
Global Moderator
Mod God
*****
Offline Offline

Posts: 1806


Once a dragon, always a dragon


View Profile WWW
« Reply #11 on: April 02, 2005, 08:59:23 PM »

No, that one is in the correct place.

I'm going to create a character on your game.  If you will trust me with SU privs, I will poke around and see what I can see, but I'm *very* certain the problem lies with your code or one of the modules.

Please give me (at a minimum) the view source privs, and the debug output privs.
Logged

Ex co-developer of LotGD
Dannic
Guest
« Reply #12 on: April 02, 2005, 09:03:57 PM »

its probably a module.

The one i'm having most problems with is lonnys castle.

Though the faq is causing an issue which i really don't understand.
Logged
lonnyl
Guest
« Reply #13 on: April 04, 2005, 05:16:50 AM »

Have you updated these modules?Huh I am no longer getting errors from my modules.... (granted I haven't updated the specialties, as they are in sixfoot's folder).  
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #14 on: April 04, 2005, 05:25:22 AM »

(granted I haven't updated the specialties, as they are in sixfoot's folder).  

yeah yeah yeah, i'm on it  Tongue
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Who's Online
27 Guests, 2 Users
Cory2, Oak
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search