I made another one, this one is using the Q command 'whoami'
So no multiple request to Q.
The script should start on start, if not, start the script by using /checktimer
It will check if it has flags on the channels its on (10 minute interval ($interval)), if not, strike one, and so on up to 3 (totalstrike), and the bot will part the channel.
If you encounter any bugs or errors please post them here.
Have fun
Change:
- inifile
developmentchannel
totalstrike
excludechannels
interval
- Code: Select all
alias -l inifile { return file.ini }
alias -l developmentchannel { return #secret_channel }
alias -l totalstrike { return 3 }
alias -l excludechannels { return #channel1 #channel2 #channel3 }
alias -l interval { return 600 }
on *:START: checktimer
alias checktimer {
.timer.checkflag 1 $interval checktimer
.remini $inifile flags
.msg Q whoami
}
alias checkflags {
var %x = $comchan($me,0)
while (%x) {
var %c = $comchan($me,%x)
if (!$readini($inifile,react,%c)) { .writeini -n $inifile react %c 0 }
if (!$istok($excludechannels,%c,32)) {
if (!$readini($inifile,flags,%c)) {
var %r = $readini($inifile,react,%c)
var %s = $calc(%r + 1)
.writeini -n $inifile react %c %s
.msg $developmentchannel Channel %c Strike %s out of $totalstrike
}
if ($readini($inifile,react,%c) == $totalstrike) {
.msg $developmentchannel Channel: %c Strike out $totalstrike
.remini $inifile react
if ($me ison %c) {
.part %c
}
}
}
dec %x
}
}
on *:NOTICE:*:?: {
if ($nick == Q) {
if ($left($1,1) == $chr(35)) {
.writeini -n $inifile flags $1 $2
}
if (*End of list* iswm $1-) {
checkflags
}
}
}