Eggdrop Documentations - 12. Control procedures

30-12-2010 10:52

12. Control procedures

Using the 'control' command, you can put a DCC connection (or outgoing TCP connection) in control of a script. All text received from the connection is sent to the proc you specify. All outgoing text should be sent with 'putdcc'.

The control procedure is called with these parameters:

procname <idx> <input-text>

This allows you to use the same proc for several connections. The idx will stay the same until the connection is dropped. After that, it will probably get reused for a later connection.

To indicate that the connection has closed, your control procedure will be called with blank text (the input-text will be ""). This is the only time it will ever be called with "" as the text, and it is the last time your proc will be called for that connection. Don't call killdcc on the idx when text is blank, it will always fail with "invalid idx".

If you want to hand control of your connection back to Eggdrop, your proc should return 1. Otherwise, return 0 to retain control.