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

	<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>2018-07-24T02:29:51-04:00</updated>

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

		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2018-04-16T18:00:53-04:00</updated>

		<published>2018-04-16T18:00:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106810#p106810</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106810#p106810"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106810#p106810"><![CDATA[
Thanks for testing that, Draknon:)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Apr 16, 2018 6:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2018-07-24T02:29:51-04:00</updated>

		<published>2018-04-16T04:53:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106809#p106809</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106809#p106809"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106809#p106809"><![CDATA[
Is there a reason for complicating things and not using the example in <em class="text-italics">Basic File Operations</em>?<div class="codebox"><p>Code: </p><pre><code># open file for read accessset fp [open $filename "r"]# read in all of the dataset data [read -nonewline $fp] # split the data into linesset lines [split $data "\n"]# close the file, since we're done readingclose $fp# count the number of linesset numlines [llength $lines]# grab a random lineset num [expr {int(rand()*$numlines) + 1}]# grab the random picked line from the listset randline [lindex $lines $num]puthelp "PRIVMSG $ch :$randline" </code></pre></div>I added the random part cos [rand 10] for instance starts from 0 instead of 1 and will go up to 9 instead of 10. But if you insist into using rand then make it <em class="text-italics">[expr [rand $numlines] +1]</em> to fix the randomness. In Spike's example would be <em class="text-italics">[expr [rand $msglist] +1]</em><br><br>If you want to spice things up a bit by adding the name of the person that joined or the channel inside the line you are reading you can adjust your lines to have them in a format for example:<div class="codebox"><p>Code: </p><pre><code>hello %nick, welcome to %chan channel..shhh! %nick joined, let's stop talking about him in %chan channel xD... and so on</code></pre></div>then that:<div class="codebox"><p>Code: </p><pre><code>puthelp "PRIVMSG $ch :$randline" </code></pre></div>line becomes:<div class="codebox"><p>Code: </p><pre><code>puthelp "PRIVMSG $ch :[string map [list %nick $nk %chan $ch] $randline]"</code></pre></div>and the bot will substitute %nick with the actual nick and %chan with the actual channel name.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Apr 16, 2018 4:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Draknon]]></name></author>
		<updated>2018-04-16T01:18:37-04:00</updated>

		<published>2018-04-16T01:18:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106808#p106808</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106808#p106808"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106808#p106808"><![CDATA[
so far it seems to be working perfectly.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12740">Draknon</a> — Mon Apr 16, 2018 1:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Draknon]]></name></author>
		<updated>2018-04-15T01:34:08-04:00</updated>

		<published>2018-04-15T01:34:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106807#p106807</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106807#p106807"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106807#p106807"><![CDATA[
<blockquote class="uncited"><div>Draknon: a little late, but please try this out and see if it will run:) </div></blockquote>I'll give it a shot..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12740">Draknon</a> — Sun Apr 15, 2018 1:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2018-04-15T11:07:58-04:00</updated>

		<published>2018-04-14T12:38:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106806#p106806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106806#p106806"/>
		<title type="html"><![CDATA[Delayed Random Greet v.0.1 by SpiKe^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106806#p106806"><![CDATA[
Draknon: a little late, but please try this out and see if it will run:)<br><div class="codebox"><p>Code: </p><pre><code># Delayed Random Greet v.0.1 by SpiKe^^ (14Apr2018) ## set file name to read #set filename "yourfile.txt"# set send message delay (in seconds) #set msgdelay "180"# set channel(s) this script monitors (space sep list) ##  ex.  set msgchan "#channel"#  ex.  set msgchan "#chan #chan2 #another"#  or use "*" for all channels the bot is on.set msgchan "*"####### End of Settings #######bind join - * checkjoinset msgchan [split $msgchan]proc checkjoin {nk uh hn ch} {  global msgdelay msgchan  if {[lsearch -nocase $msgchan $ch]=="-1" || [isbotnick $nk]} {    return 0  }  utimer $msgdelay [list sendrandom $nk $ch]  return 0}proc sendrandom {nk ch} {  global filename msglist  if {![file exists $filename]} {  return 0  }  # read the entire file into a list #  set openfile [open $filename "r"]  set data [split [read -nonewline $openfile] "\n"]  close $openfile  # does some short term msg tracking #  # tries to read all lines once, before reading any lines a second time #  # .restart or killing the bot will clear this tracking data #  if {![info exists msglist]} {  set cnt 0    set x [llength $data]    while {$cnt &lt; $x} {      lappend msglist $cnt      incr cnt    }  }  # choose a random line from the file #  if {[llength $msglist]==1} {    set nxidx [join $msglist]    unset msglist  } else {  set x [rand [llength $msglist]]    set nxidx [lindex $msglist $x]    set msglist [lreplace $msglist $x $x]  }  set next [lindex $data $nxidx]  puthelp "PRIVMSG $ch :$next"  return 0}putlog "Delayed Random Greet v.0.1 loaded."</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sat Apr 14, 2018 12:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Draknon]]></name></author>
		<updated>2018-04-14T02:22:20-04:00</updated>

		<published>2018-04-14T02:22:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106802#p106802</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106802#p106802"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106802#p106802"><![CDATA[
thanks a lot .. got it all done now <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12740">Draknon</a> — Sat Apr 14, 2018 2:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2018-04-14T00:55:23-04:00</updated>

		<published>2018-04-14T00:55:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106801#p106801</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106801#p106801"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106801#p106801"><![CDATA[
1. You can turn the "*!*@*" turned into "*" without a problem.<br><br>2. In this case an <em class="text-italics">utimer</em> will do the trick. Have a look at tcl-commands.doc that comes with the bot in it's doc folder (or grab it from <a href="https://www.dropbox.com/s/qrxa76l7ggvv50u/tcl-commands.pdf?dl=0" class="postlink">here</a> in pdf format) where everything is nicely explained.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Apr 14, 2018 12:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Draknon]]></name></author>
		<updated>2018-04-12T07:08:28-04:00</updated>

		<published>2018-04-12T07:08:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106799#p106799</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106799#p106799"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106799#p106799"><![CDATA[
1st: thank you very much, that will help immensly..<br><br>2nd:  <blockquote class="uncited"><div>As for the mIRC code you mentioned it spits out a line from that file every 3 minutes? Dose it ever stops? When?</div></blockquote>it is only triggered when a person joins the chan then 3 min later plays 1 random line and stops there.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12740">Draknon</a> — Thu Apr 12, 2018 7:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2018-04-12T06:56:08-04:00</updated>

		<published>2018-04-12T06:56:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106798#p106798</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106798#p106798"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106798#p106798"><![CDATA[
Have a look at <a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">Basic File Operations</a> where you will find a few examples on how to read a line, multiple or even a random line.<br><br>As for the mIRC code you mentioned it spits out a line from that file every 3 minutes? Dose it ever stops? When?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Apr 12, 2018 6:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Draknon]]></name></author>
		<updated>2018-04-12T05:50:22-04:00</updated>

		<published>2018-04-12T05:50:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106797#p106797</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106797#p106797"/>
		<title type="html"><![CDATA[I have gone brain fried trying to learn this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106797#p106797"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>on 1:JOIN:#:/play -r #The-Dungeon C:\random\random.txt 120000</code></pre></div>what that line does is "plays"(similar to PRIVMSG $chan) a random line from file random.txt at a 3 min delay<br><br>so my question is either where do I get the info for getting a random line from a file to send to the chan or.. what is the command to do it?<br><br>and would the bind look like .. <div class="codebox"><p>Code: </p><pre><code>bind join - *!*@* join_random</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12740">Draknon</a> — Thu Apr 12, 2018 5:50 am</p><hr />
]]></content>
	</entry>
	</feed>
