egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Module Timed Think Function

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
rrc55
Voice


Joined: 11 Mar 2009
Posts: 29

PostPosted: Tue Jul 15, 2014 6:33 pm    Post subject: Module Timed Think Function Reply with quote

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.
Back to top
View user's profile Send private message
rrc55
Voice


Joined: 11 Mar 2009
Posts: 29

PostPosted: Wed Jul 16, 2014 1:51 am    Post subject: Reply with quote

I figured it out in case anyone is interested.

Code:
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.
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3475
Location: Area 51

PostPosted: Wed Jul 16, 2014 9:07 am    Post subject: Reply with quote

And why would you bother with this if there's time or cron binds?
_________________
You may say anything about me, but at least don't misspell my name. xD
Back to top
View user's profile Send private message
rrc55
Voice


Joined: 11 Mar 2009
Posts: 29

PostPosted: Wed Jul 16, 2014 10:31 pm    Post subject: Reply with quote

What are those and how do you use them?
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3475
Location: Area 51

PostPosted: Thu Jul 17, 2014 2:12 am    Post subject: Reply with quote

If you don't have TCL Commands file then grab it from here and then look at the bind cron or bind time.
_________________
You may say anything about me, but at least don't misspell my name. xD
Back to top
View user's profile Send private message
rrc55
Voice


Joined: 11 Mar 2009
Posts: 29

PostPosted: Thu Jul 17, 2014 10:05 am    Post subject: Reply with quote

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber