Hello,
I would like to know what is the best way to reuse code between different scripts?
I'll split my post into multiple questions:
1) Is there a way to invoke a procedure that belongs to script #1 from within script #2?
I know about the "source" command, but I don't think it's healthy to invoke the same script multiple times. script #1 contains binds and one-time inits which I don't want to run more than once.
2) Is there a way to trigger a bind manually? I mean script #1 binds the proc to a specific event, which script #2 will trigger using some TCL command.
3) Relates to question #2 - Is there a way to make the bot trigger events on their own IRC commands? For instance, if I bind something to pubm on #chan - can the bot somehow trigger that event when it performs PRIVMSG #chan text?
Thank you for your help.
[EDIT: I was able to solve 1) using namespaces. Would still like to hear opinions regarding 2) and 3)]