<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18562" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2011-07-27T08:54:52-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18562</id>

		<entry>
		<author><name><![CDATA[blake]]></name></author>
		<updated>2011-07-27T08:54:52-04:00</updated>

		<published>2011-07-27T08:54:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97287#p97287</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97287#p97287"/>
		<title type="html"><![CDATA[modify of jokes.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97287#p97287"><![CDATA[
Hey im using the following script to add jokes to a channel but have to type .joke per every joke is what i would like for it to do is type .joke once and then it just outputs one line at a time by its self<br><div class="codebox"><p>Code: </p><pre><code># Jokes.tcl - Copyright C.Leonhardt Nov.25.2006 - rosc2112 at yahoo com http://members.dandy.net/~fbn/jokes.tcl.txt# Pulls a random joke from a file and spits it out in channel. If you format jokes with a semi-colon seperator, # it'll add a small delay to the subsequent parts of a joke (for like, Have you heard about? type jokes)# Lines can have more than 1 seperator.# Example: What do you call two butches bonding?;Hockey night in Canada.# The second part ("Hockey night in Canada") will be shown after the delay.# If there is no semi-colon seperator, then the entire joke on one line will be shown. Joke length per line # is limited by your IRCD's line length (generally 400 chars long.)# You will need to rehash if you edit your jokes file, since it's only read once, when this script is (re)loaded.# Usage:  .joke   -   Typed in channel# Todo:  Create function to add/delete jokes from the joke file (me being lazy today..)#----------------------------------------------------------------------------------------------------------------------# Config ##--------## Channels where we allow public use:set jokechans "#ComedyCentral #Staff"# Out of the above channels, these ones will send responses only to PRIVMSG:set jokequietchans "#Staff"# Joke file (Remember to have only 1 joke per line, with semi-colon seperators if it's a multi-part joke)set jokefile "/home/eggdrop/ComedyBot/jokes.txt"# How many seconds delay between parts of a joke do you want to wait before showing the next part?set jokedelay 5#----------------------------------------------------------------------------------------------------------------------# Code below ##------------#catch {unbind pub - .joke proc:joke}if {[file exists $jokefile]} {set jdata ""set jokesin [open $jokefile r]set jokesdata [split [read $jokesin] \n]catch {close $jokesin}foreach line $jokesdata {set line [string trim $line]if {$line != ""} {lappend jdata $line}}if {$jdata != ""} {set jokesdata $jdatabind pub - .joke proc:jokeputlog "Jokes.tcl 0.1a by rosc - Loaded jokefile.."} else {putlog "Jokes.tcl: \002Joke data was empty! Not binding command..\002"}} else {putlog "Jokes.tcl: \002No joke file found. Not binding command..\002"}proc proc:joke {nick host hand chan text} {global jokesdata jokedelayif {([lsearch -exact $::jokechans $chan] == -1)} {return}if {([lsearch -exact $::jokequietchans $chan] != -1)} {set chan $nick}set joke [lindex $jokesdata [rand [llength $jokesdata]]]set jokeparts [split $joke \;]set jokellen [llength $jokeparts]for {set j 0} {$j &lt; $jokellen} {incr j} {if {$j == 0} {puthelp "PRIVMSG $chan :[lindex $jokeparts $j]"} else {utimer [expr $jokedelay * $j] [list jokespew $chan [lindex $jokeparts $j]]}}}proc jokespew {chan text} {puthelp "PRIVMSG $chan :$text"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10512">blake</a> — Wed Jul 27, 2011 8:54 am</p><hr />
]]></content>
	</entry>
	</feed>
