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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Kaj
Voice
Posts: 3 Joined: Sun Sep 22, 2013 5:09 am
Post
by Kaj » Thu Oct 16, 2014 11:32 am
Hey,
I'd like to make a TCL script for my eggdrop that will let the bot leave inactive channels (e.g. channels where nothing was said past 2 days).
I have no idea how to do this so is there anyone that can give me any advice on how I should approach this problem?
Sincerely,
Kaj
Kaj
Voice
Posts: 3 Joined: Sun Sep 22, 2013 5:09 am
Post
by Kaj » Thu Dec 18, 2014 8:32 am
bump
willyw
Revered One
Posts: 1209 Joined: Thu Jan 15, 2009 12:55 am
Post
by willyw » Thu Dec 18, 2014 9:47 am
Is it because you know no TCL at all?
Would this be your first script?
We need more info from you, to know how to go about answering/helping you. Usually this can be determined by the poster such as yourself, posting the code that they have written and been trying so far.
Have you tried? Written any part or parts of it yourself, yet?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Fri Dec 19, 2014 4:59 am
Haven't tested this, so give it a try and report back if you got any problems.
By default ALL channels will be monitored and removed once the 24 hours deadline hits, so if you want any channels not to be checked then from DCC Chat/Telnet with the bot set them to +skipCheck with
.chanset #channel +skipCheck
Code: Select all
namespace eval inactiveCheck {
variable inactive "172800" # in seconds
setudef flag skipCheck
setudef int lastwords
bind pubm * * [namespace current]::save
bind cron - {?0*} [namespace current]::check
bind join * * [namespace current]::joined
proc save {nick uhost hand chan text} {
if {![channel get $chan skipCheck]} {
channel set $chan lastwords [unixtime]
} else {
channel set $chan lastwords 0
}
}
proc check {min hour day month weekday} {
variable inactive
foreach chan [channels] {
if {[channel get $chan skipCheck]} continue
set lastwords [channel get $chan lastwords]
if {$lastwords > 0} {
set difference [expr [unixtime] - $lastwords]
if {$difference >= $lastwords} {
channel remove $chan
putlog "inactiveCheck: removing inactive $chan channel cos last spoken words where [duration $difference] ago."
}
}
}
}
proc joined {nick uhost hand chan} {
if {[isbotnick $nick]} {
if {![channel get $chan skipCheck]} {
channel set $chan lastwords [unixtime]
} else {
channel set $chan lastwords 0
}
}
}
}
I've also moved this to
Script Requests as it seems to fit this section better.
Once the game is over, the king and the pawn go back in the same box.