View previous topic :: View next topic |
Author |
Message |
Rash Voice
Joined: 20 Jan 2022 Posts: 6
|
Posted: Fri Jun 24, 2022 8:22 pm Post subject: Markov Chain'ish Script |
|
|
A longtime IRC Friend recently died and I would love to honor his memory by having a bot that spouts out a sentence or two based off of what he previously has said.
I am sure this already exists. I was thinking of a trigger such as Andrew? |
|
Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1193
|
Posted: Sat Jun 25, 2022 7:31 am Post subject: Re: Markov Chain'ish Script |
|
|
Anything here that will do what you want?
http://tclarchive.org/search.php?Quote _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 831 Location: Tennessee, USA
|
Posted: Sat Jun 25, 2022 1:08 pm Post subject: Read random file line |
|
|
Here's something quite basic to work with...
From http://forum.egghelp.org/viewtopic.php?t=20572 (Thanks willyw:) Code: |
# Jan 11, 2019
# http://forum.egghelp.org/viewtopic.php?t=20572
#
# Real simple... just want any user to be able to type !topic making the bot pull a random line from the topic.txt file and post to the channel
# with "Your topic is..." preceding the line.
#
###################################################################
### config ###
# set the path/filename to the topic.txt file
set topicfile "scripts/added/experiment_for_somebody/random_line_from_file/topic.txt"
### end config ###
bind pub - "!topic" random_line
#####
proc random_line {nick uhost handle chan text} {
global topicfile
if {![file exists $topicfile]} {
putserv "privmsg $chan :Sorry $nick, but $topicfile doesn't exist"
return 0
}
# reference : http://forum.egghelp.org/viewtopic.php?t=6885
set fp [open $topicfile "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set numlines [llength $lines]
set num [rand $numlines]
set randline [lindex $lines $num]
putserv "privmsg $chan :Your topic is: $randline"
}
#####
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1193
|
Posted: Sat Jun 25, 2022 3:55 pm Post subject: Re: Read random file line |
|
|
Wow ... I sure recognized the style! But I'd totally forgotten it.
Thank YOU for posting it and the link to that thread. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
Back to top |
|
 |
|