<?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/20572" />

	<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>2019-01-12T10:17:57-04:00</updated>

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

		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2019-01-12T10:17:57-04:00</updated>

		<published>2019-01-12T10:17:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107337#p107337</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107337#p107337"/>
		<title type="html"><![CDATA[Super simple random msg from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107337#p107337"><![CDATA[
<blockquote class="uncited"><div>Thanks so much! Tested and worked beautifully. <br></div></blockquote>Good to hear.<br>And -  you're welcome.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><blockquote class="uncited"><div>Now to compare that one with all the failed attempts to learn "what went wrong" lol</div></blockquote>As caesar said - follow that link that I put in a comment in the script.<br>It's a great reference. <br>Whenever I'm thinking through just how I want to get something done, and realize I'm going to need to do at least one of the 4 or 5 things described there,  I just come here to this forum, to that Tcl FAQ section, and get it in front of me.   It's terrible... I've used those things many, many times, and since I don't HAVE to remember them - exactly -  , I don't.  I just click up those posts.    <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>It sure beats digging through all my old scripts to find examples.   <br><br>Next, here are a couple links that I think are essential to open and keep in tabs, handy for quick reference, whenever one is messing with Tcl :<br><br>The Eggdrop specific Tcl commands:<br><a href="http://docs.eggheads.org/mainDocs/tcl-commands.html" class="postlink">http://docs.eggheads.org/mainDocs/tcl-commands.html</a><br><br>The rest of Tcl commands:<br><a href="http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm" class="postlink">http://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm</a><br><br><br>Then, there is this old tutorial.  Still great for getting one started, and for quick reference for a lot of things.<br><a href="http://suninet.the-demon.de/" class="postlink">http://suninet.the-demon.de/</a><br><br>I hope this helps.<br><br>As you experiment, feel free to post the code you are working on, with your questions.  Somewhere around here is an appropriate section of the forum for that.  And somebody will advise you.<br><br>If the code gets long (and it will), rather than use the [ code ] [ /code ] bbcode in here, you might like to use:<br><a href="http://paste.tclhelp.net/" class="postlink">http://paste.tclhelp.net/</a><br>Bonus !  - that pastebin even tries to show you your errors.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Have fun with your bot, and with writing Tcl for it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sat Jan 12, 2019 10:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2019-01-12T07:14:55-04:00</updated>

		<published>2019-01-12T07:14:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107336#p107336</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107336#p107336"/>
		<title type="html"><![CDATA[Super simple random msg from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107336#p107336"><![CDATA[
Have a look at <a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">Basic File Operations</a> like willyw mentioned in his code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Jan 12, 2019 7:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crymsun]]></name></author>
		<updated>2019-01-11T22:09:32-04:00</updated>

		<published>2019-01-11T22:09:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107335#p107335</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107335#p107335"/>
		<title type="html"><![CDATA[Super simple random msg from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107335#p107335"><![CDATA[
Thanks so much! Tested and worked beautifully. <br><br>Now to compare that one with all the failed attempts to learn "what went wrong" lol<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12774">crymsun</a> — Fri Jan 11, 2019 10:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2019-01-11T13:25:08-04:00</updated>

		<published>2019-01-11T13:25:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107334#p107334</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107334#p107334"/>
		<title type="html"><![CDATA[Re: Super simple random msg from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107334#p107334"><![CDATA[
<blockquote class="uncited"><div>...<br>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.<br><br>That's it.<br>...</div></blockquote>Tested only briefly.  Worked.<br><div class="codebox"><p>Code: </p><pre><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 fileset 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"}#####</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Fri Jan 11, 2019 1:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crymsun]]></name></author>
		<updated>2019-01-11T11:20:10-04:00</updated>

		<published>2019-01-11T11:20:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107332#p107332</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107332#p107332"/>
		<title type="html"><![CDATA[Super simple random msg from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107332#p107332"><![CDATA[
Have gone out of my mind trying to edit "random timed message" and advertise scripts - so far three have crashed the bot and I'm out of patience. Have used scripts from here and the tcl archive.  The problem is, I don't want a timer at all or for users to add/delete.<br><br>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.<br><br>That's it. For some reason, trying to modify more complex scripts is not working... there must be something important that I'm editing or deleting.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12774">crymsun</a> — Fri Jan 11, 2019 11:20 am</p><hr />
]]></content>
	</entry>
	</feed>
