Setudef
Eggdrop users often like a script's functionality to work on only some of the channels the Eggdrop resides on. For example, an Eggdrop running a Tcl script that greets every user is nice on a small channel, but would quickly become annoying on a busy channel where users are joining every 30 seconds. There are two ways you can enable a script to work on only some channels the Eggdrop resides on.
User-defined Channel Flags (Preferred)
From doc/tcl-commands.doc, you can use the setudef command:
setudef <flag/int/str> <name> Description: initializes a user defined channel flag, string or integer setting. You can use it like any other flag/setting. IMPORTANT: Don’t forget to reinitialize your flags/settings after a restart, or it’ll be lost.
This command creates a new flag setting that can be used via the
.chanset
command, and viewed via the
.chaninfo
command. To create a custom flag that a script can check, create it by adding the setudef command:
setudef flag myscript
This will add a flag that can be viewed, enabled or disabled via the partyline:
User defined channel flags: -myscript
As with any other Eggdrop channel flag, it can be enabled or disabled with the .chanset command:
.chanset #test +myscript Successfully set modes { +myscript } on #test. [22:42:18] #-HQ# chanset #test +myscript .chaninfo #test User defined channel flags: +myscript