This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Discussion of Eggdrop's code and module programming in C.
rrc55
Voice
Posts: 29 Joined: Wed Mar 11, 2009 9:33 am
Post
by rrc55 » Tue Jul 15, 2014 6:33 pm
I want to write a command independent mod function that performs a task at a regular interval. How do I export it to the core? Is there a better way? Thank you.
rrc55
Voice
Posts: 29 Joined: Wed Mar 11, 2009 9:33 am
Post
by rrc55 » Wed Jul 16, 2014 1:51 am
I figured it out in case anyone is interested.
Code: Select all
void ecgn_test(void)
{
dprintf(DP_SERVER, "PRIVMSG %s :TESTING\n", "#ecgn");
}
char *ecgn_start(Function *func_table)
{
global = func_table;
module_register(MODULE_NAME, ecgn_table, 1, 2);
if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 3)))
return "This module requires irc 1.3 or later.";
if (!module_depend(MODULE_NAME, "eggdrop", 108, 0))
return "This module requires eggdrop1.8 or later.";
add_hook(HOOK_MINUTELY, (Function) ecgn_test);
add_builtins(H_pub, stat_cmd);
return NULL;
}
The key here is the add_hook() function. This will call my ecgn function every minute without having to bind it to a command. This is exactly what I wanted.
Hope this helps someone.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jul 16, 2014 9:07 am
And why would you bother with this if there's time or cron binds?
Once the game is over, the king and the pawn go back in the same box.
rrc55
Voice
Posts: 29 Joined: Wed Mar 11, 2009 9:33 am
Post
by rrc55 » Wed Jul 16, 2014 10:31 pm
What are those and how do you use them?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Thu Jul 17, 2014 2:12 am
If you don't have TCL Commands file then grab it from
here and then look at the
bind cron or
bind time .
Once the game is over, the king and the pawn go back in the same box.
rrc55
Voice
Posts: 29 Joined: Wed Mar 11, 2009 9:33 am
Post
by rrc55 » Thu Jul 17, 2014 10:05 am
Thanks.