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

	<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-06-29T02:09:41-04:00</updated>

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

		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2011-06-29T02:09:41-04:00</updated>

		<published>2011-06-29T02:09:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97118#p97118</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97118#p97118"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97118#p97118"><![CDATA[
Sorry, I forgot about <div class="codebox"><p>Code: </p><pre><code>return 0</code></pre></div> after <div class="codebox"><p>Code: </p><pre><code>putserv "PRIVMSG $rchan :$text"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Wed Jun 29, 2011 2:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2011-06-28T17:36:23-04:00</updated>

		<published>2011-06-28T17:36:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97114#p97114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97114#p97114"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97114#p97114"><![CDATA[
splendid! thanks for all the help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Jun 28, 2011 5:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-06-28T17:16:38-04:00</updated>

		<published>2011-06-28T17:16:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97113#p97113</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97113#p97113"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97113#p97113"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># Set here, the channel you want the bot to listen for messages on                       set mchan "#PremierLeague"# Set here, the channel you want the messages to be relayed to.                           set rchan "#EPL"# Add a word for relaybind pub n|o !addword addword# View a list of your relaysbind pub o|o !relays relays# Clear all relays from wordsEPL.txtbind pub o|o !relayclr msgclear# This is what searches for and relays linesbind pubm * * relay_to_chan# Delete a relay word from filebind pub n|o !delword delwordproc addword {nick host hand chan text} {  global mchan  if {[string equal -nocase $chan $mchan]} {    set mfs "wordsEPL.txt"    set word [join [lindex [split $text] 0]]    if {![file exists $mfs]} {      close [open $mfs w]    }    set fs [open $mfs]    set data [read -nonewline $fs]    close $fs    if {![string length $data]} {      set fs [open $mfs w]    } else {      set fs [open $mfs a]    }    puts $fs "$word"    close $fs    putserv "NOTICE $nick :Relay added: $word"  }  return}proc relays {nick host hand chan text} {  set fs [open "wordsEPL.txt"]  set data [read -nonewline $fs]  close $fs  if {![string length $data]} {    putserv "NOTICE $nick :I don't currently have any messages to relay."    return 0  }  putserv "NOTICE $nick :My list of relay messages is as follows:"  set fs [open "wordsEPL.txt"]  seek $fs 0 start  while {[gets $fs line] &gt;= 0} {    puthelp "NOTICE $nick :$line"  }  close $fs}proc msgclear {nick host hand chan text} {  close [open "wordsEPL.txt" w]}proc relay_to_chan {nick host hand chan text} {  global mchan rchan  if {[string equal -nocase $chan $mchan]} {    set fs [open "wordsEPL.txt"]    seek $fs 0 start    while {[gets $fs line] &gt;= 0} {      if {[regexp -nocase ".*$line.*" $text match]} {        putserv "PRIVMSG $rchan :$match"        break      }    }    close $fs    return  }  return}proc delword {nick host hand chan text} {  global mchan  if {[string equal -nocase $chan $mchan]} {    set word [lindex [split $text] 0]    set fs [open "wordsEPL.txt"]    set words [split [read -nonewline $fs] \n]    close $fs    set match [lsearch -exact $words $word]    set fs [open "wordsEPL.txt" w]    set newwords [lreplace $words $match $match]    puts $fs [join $newwords "\n"]    close $fs    putserv "NOTICE $nick :Relay deleted: $word."  }  return}</code></pre></div>Adjusted indenting, and added the changes in my earlier post. Rest is as it was initially.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 28, 2011 5:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2011-06-28T17:11:37-04:00</updated>

		<published>2011-06-28T17:11:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97112#p97112</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97112#p97112"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97112#p97112"><![CDATA[
oh, errr<br><br>might writing the proper script in full?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Jun 28, 2011 5:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-06-28T17:09:31-04:00</updated>

		<published>2011-06-28T17:09:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97111#p97111</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97111#p97111"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97111#p97111"><![CDATA[
That is quite far from the original proc. The suggested fix should be applied to the <em class="text-italics">relay_to_chan</em> proc, not the other ones.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 28, 2011 5:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2011-06-28T16:35:14-04:00</updated>

		<published>2011-06-28T16:35:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97110#p97110</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97110#p97110"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97110#p97110"><![CDATA[
Sure<div class="codebox"><p>Code: </p><pre><code># Set here, the channel you want the bot to listen for messages onset mchan "#PremierLeague" # Set here, the channel you want the messages to be relayed to.set rchan "#EPL" # Add a word for relay bind pub n|o !addword addword # View a list of your relays bind pub o|o !relays relays # Clear all relays from words.txt bind pub o|o !relayclr msgclear # This is what searches for and relays lines bind pubm * * relay_to_chan # Delete a relay word from file bind pub n|o !delword delword proc addword {nick host hand chan text} {  global mchan     if {[string equal -nocase $chan $mchan]} {  set mfs "wordsEPL.txt"         set word [join [lindex [split $text] 0]]         if {![file exists $mfs]} {             close [open $mfs w]         }         set fs [open $mfs]         set data [read -nonewline $fs]   close $fs         if {![string length $data]} {             set fs [open $mfs w]         } else {             set fs [open $mfs a]         }  puts $fs "$word"   close $fs    putserv "NOTICE $nick :Relay added: $word"     }  return } proc relays {nick host hand chan text} {     set fs [open "wordsEPL.txt"]set fs [open "wordsEPL.txt"]seek $fs 0 startwhile {[gets $fs line] &gt;= 0} {  if {[regexp -nocase ".*$line.*" $text match]} {    putserv "PRIVMSG $rchan :$match"    break  }}close $fs    if {![string length $data]} {   putserv "NOTICE $nick :I don't currently have any messages to relay."  return 0     }   putserv "NOTICE $nick :My list of relay messages is as follows:"    set fs [open "wordsEPL.txt"]seek $fs 0 startwhile {[gets $fs line] &gt;= 0} {  if {[regexp -nocase ".*$line.*" $text match]} {    putserv "PRIVMSG $rchan :$match"    break  }}close $fs} proc msgclear {nick host hand chan text} {     close [open "wordsEPL.txt" w] } proc relay_to_chan {nick host hand chan text} {   global mchan rchan         if {[string equal -nocase $chan $mchan]} {  set fs [open "wordsEPL.txt"]    set fs [open "wordsEPL.txt"]seek $fs 0 startwhile {[gets $fs line] &gt;= 0} {  if {[regexp -nocase ".*$line.*" $text match]} {    putserv "PRIVMSG $rchan :$match"    break  }}close $fsreturn         }  return } proc delword {nick host hand chan text} {  global mchan     if {[string equal -nocase $chan $mchan]} {  set word [lindex [split $text] 0]  set fs [open "wordsEPL.txt"]  set words [split [read -nonewline $fs] \n]    close $fs  set match [lsearch -exact $words $word]  set fs [open "wordsEPL.txt" w]  set newwords [lreplace $words $match $match]    puts $fs [join $newwords "\n"]    close $fs     putserv "NOTICE $nick :Relay deleted: $word."     }    return } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Jun 28, 2011 4:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-06-28T16:32:51-04:00</updated>

		<published>2011-06-28T16:32:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97109#p97109</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97109#p97109"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97109#p97109"><![CDATA[
Could you post your new version of the <em class="text-italics">relays</em> proc?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 28, 2011 4:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2011-06-28T12:06:03-04:00</updated>

		<published>2011-06-28T12:06:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97108#p97108</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97108#p97108"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97108#p97108"><![CDATA[
hey nml375 and username.<br><br>Thanks so much for the reply.<br><br>nml375 - that worked well, though it seems to have caused a new problem:<br><br>[19:04:50] &lt;@DontPanic&gt; !relays<br>[19:04:07] &lt;BarraBrava&gt; [16:04:14] Tcl error [relays]: can't read "data": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Jun 28, 2011 12:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-06-28T11:28:45-04:00</updated>

		<published>2011-06-28T11:28:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97106#p97106</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97106#p97106"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97106#p97106"><![CDATA[
I'm afraid that change will not sort the issue;<br><br>I'd suggest you add a break to stop the loop once you've found a match:<div class="codebox"><p>Code: </p><pre><code>set fs [open "wordsEPL.txt"]seek $fs 0 startwhile {[gets $fs line] &gt;= 0} {  if {[regexp -nocase ".*$line.*" $text match]} {    putserv "PRIVMSG $rchan :$match"    break  }}close $fs</code></pre></div>PS. I took the liberty of removing some pointless list operations (split, lrange all, join). DS<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Jun 28, 2011 11:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2011-06-28T09:31:37-04:00</updated>

		<published>2011-06-28T09:31:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97105#p97105</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97105#p97105"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97105#p97105"><![CDATA[
Try to change <br><div class="codebox"><p>Code: </p><pre><code>set fs [open "wordsEPL.txt"] seek $fs 0 start while {[gets $fs line] &gt;= 0} { if {[regexp -nocase ".*$line.*" [join [lrange [split $text] 0 end]] match]} { putserv "PRIVMSG $rchan :$match" }</code></pre></div>to <br><div class="codebox"><p>Code: </p><pre><code>foreach line [split [read [set fid [open "wordsEPL.txt" "r"]]] "\n"] {    if {[string match -nocase "*line*" $text]} {        putserv "PRIVMSG $rchan :$text"     }}close $fid</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Tue Jun 28, 2011 9:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2011-06-28T06:32:12-04:00</updated>

		<published>2011-06-28T06:32:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97104#p97104</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97104#p97104"/>
		<title type="html"><![CDATA[relay.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97104#p97104"><![CDATA[
Hey, I`m using relay.tcl, it relays words that are written in a text file from one channel another, the problem is that if you have two words in the text file that match in the same setence, it will relay the message more then once.<br><br>Lets say our text file includes the words "Hello there"<br>and the sentence is "Hello there Tony"<br>It will relay the sentence twice (as many times as it matches the text file)<br><br>Can anyone fix it so it won't relay it more then once please?<br><br>Thank you.<div class="codebox"><p>Code: </p><pre><code># Set here, the channel you want the bot to listen for messages on                        set mchan "#PremierLeague" # Set here, the channel you want the messages to be relayed to.                            set rchan "#EPL" # Add a word for relay bind pub n|o !addword addword # View a list of your relays bind pub o|o !relays relays # Clear all relays from wordsEPL.txt bind pub o|o !relayclr msgclear # This is what searches for and relays lines bind pubm * * relay_to_chan # Delete a relay word from file bind pub n|o !delword delword proc addword {nick host hand chan text} {  global mchan     if {[string equal -nocase $chan $mchan]} {  set mfs "wordsEPL.txt"         set word [join [lindex [split $text] 0]]         if {![file exists $mfs]} {             close [open $mfs w]         }         set fs [open $mfs]         set data [read -nonewline $fs]   close $fs         if {![string length $data]} {             set fs [open $mfs w]         } else {             set fs [open $mfs a]         }  puts $fs "$word"   close $fs    putserv "NOTICE $nick :Relay added: $word"     }  return } proc relays {nick host hand chan text} {     set fs [open "wordsEPL.txt"]     set data [read -nonewline $fs]   close $fs     if {![string length $data]} {   putserv "NOTICE $nick :I don't currently have any messages to relay."  return 0     }   putserv "NOTICE $nick :My list of relay messages is as follows:"     set fs [open "wordsEPL.txt"]   seek $fs 0 start     while {[gets $fs line] &gt;= 0} {   puthelp "NOTICE $nick :$line"     }  close $fs } proc msgclear {nick host hand chan text} {     close [open "wordsEPL.txt" w] } proc relay_to_chan {nick host hand chan text} {   global mchan rchan         if {[string equal -nocase $chan $mchan]} {  set fs [open "wordsEPL.txt"]    seek $fs 0 start      while {[gets $fs line] &gt;= 0} {          if {[regexp -nocase ".*$line.*" [join [lrange [split $text] 0 end]] match]} {    putserv "PRIVMSG $rchan :$match"          }    }  close $fs  return         }  return } proc delword {nick host hand chan text} {  global mchan     if {[string equal -nocase $chan $mchan]} {  set word [lindex [split $text] 0]  set fs [open "wordsEPL.txt"]  set words [split [read -nonewline $fs] \n]    close $fs  set match [lsearch -exact $words $word]  set fs [open "wordsEPL.txt" w]  set newwords [lreplace $words $match $match]    puts $fs [join $newwords "\n"]    close $fs     putserv "NOTICE $nick :Relay deleted: $word."     }    return } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Tue Jun 28, 2011 6:32 am</p><hr />
]]></content>
	</entry>
	</feed>
