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.

Looking for a brief history bot. Record and display 10 lines

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
bradleylauchlin
Voice
Posts: 6
Joined: Mon Apr 14, 2008 8:02 pm

Looking for a brief history bot. Record and display 10 lines

Post by bradleylauchlin »

Hi, I am looking to add a script to my bot where it records the last 10 lines from the conversation and then will message, or notice them to a user when they join the channel so that they know what is going on, and are not completely oblivious to the converstation going on as they enter.

I am fairly new to TCL scripting and can do basic stuff, but am not sure how to best approach this. If someone could get me started that would be great. Thanks.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pubm - "#channel *" record:lines
bind join - "#channel *" notice:lines

set last10Lines [list]

proc record:lines {nick uhost hand chan arg} {
 global last10Lines
 lappend last10Lines "<$nick> $arg"
 if {[llength $last10Lines] > 10} {
  set last10Lines [lrange $last10Lines end-9 end]
 }
}

proc notice:lines {nick uhost hand chan} {
 global last10Lines
 foreach line $last10Lines {
  puthelp "notice $nick :$line"
 }
}
b
bradleylauchlin
Voice
Posts: 6
Joined: Mon Apr 14, 2008 8:02 pm

Post by bradleylauchlin »

Thanks, modified it a bit for my bot, and it works perfectly. Thanks for the hand.
Post Reply