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.

start a process on startup

Old posts that have not been replied to for several years.
Locked
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

start a process on startup

Post by ShavdApe »

I have a bot that uses mysql but to do so when it first comes online I have to tell it to connect to the sql.
Is there anyway to have the bot do this automatically?
M
Massacre
Voice
Posts: 27
Joined: Wed Mar 19, 2003 4:17 pm

Post by Massacre »

I think if you just put the init code straight into a tcl script file, not in a proc then it will be run when the script is loaded, which it will be when the bot is started.
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

Code: Select all

bind evnt - init-server my:connect
proc my:connect init-server {
# Code for connecting to mysql goes here
  }
Try this :mrgreen:
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

appreciated thanks
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

bind evnt <flags> <type> <proc>
proc-name <type>

sighup
called on a kill -HUP <pid>

sigterm
called on a kill -TERM <pid>

sigill
called on a kill -ILL <pid>

sigquit
called on a kill -QUIT <pid>

save
called when the userfile is saved

rehash
called just after a rehash

prerehash
called just before a rehash

prerestart
called just before a restart

logfile
called when the logs are switched daily

loaded
called when the bot is done loading


connect-server
called just before we connect to an IRC server

init-server
called when we actually get on our IRC server

disconnect-server
called when we disconnect from our IRC server
so with the proc called by init-server you would also connect to the dbase when you are reconnecting to a server. so either use loaded or add a check if the bot is allready connected to the database
Locked