Author Topic: functions (a useful util)  (Read 2550 times)

Offline thecreator

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
functions (a useful util)
« on: September 24, 2006, 09:13:37 AM »

Hello,

I wrote this to help me out, and figured people could use it.

To get it working, update -r functions.c, and then update the command daemon.



code:

#include <lib.h>

#include <message_class.h>



inherit LIB_DAEMON;



mixed cmd(string args);

string GetHelp(string str);



mixed cmd(string str)

{

if (!str||str=="")

{

return "Syntax: functions <file>";

}

if (!file_exists(str))

{

return "Couldn't find "+str+".";

}

return this_player()->eventPage(functions(load_object(str)));

}



string GetHelp(string str)

{

return "name: functions.\n"

"syntax: functions <file>\n\n"

"Description: Will return all known functions in the specified file.\n\n"

"Coded by ~~TheCreator~~ on 09-23-06";

}





Enjoy,


~~TheCreator~~

Offline detah

  • BFF
  • ***
  • Posts: 190
  • Ruler of 2D
    • View Profile
functions (a useful util)
« Reply #1 on: September 25, 2006, 06:00:26 AM »

This is different than the standard functions() fun how?

It looks like you added the word eventPage. Is that the only difference?

In the future provide some details about what you have written. Especially when you are simply adding a tiny bit to an existing fun. Its less confusing that way.


Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
functions (a useful util)
« Reply #2 on: September 25, 2006, 06:20:12 AM »

i agree that some more detail is a good idea. Saquivor

has suggested a very useful rule for code submissions, and

whether it's eventually implemented as a site rule or not, I

would encourage people to adopt that header policy for themselves.



I also agree that TC's addition to the functionality of the

current functions() efun is not major...but I definitely appreciate

pretty much any submission, because people of different

skill levels can draw their own lessons from any code.



Still, I would remind folks:



* let us know what the code should do



* if it doesn't work, tell us what it *does* do



* if it fails, include the full error messages



Thanks for the contribution, TC. You might want to take

a look at the "showfuns" and "findfun" commands in the

alpha lib, which do something similar.



Offline detah

  • BFF
  • ***
  • Posts: 190
  • Ruler of 2D
    • View Profile
functions (a useful util)
« Reply #3 on: September 25, 2006, 04:56:46 PM »
I realize now that my comment appeared to be belittling his contribution. That was not my intent.  I simply wanted to know what the differences were. Sorry to sound snotty. I didnt mean to do that.