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

	<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>2009-02-23T08:54:49-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-23T08:54:49-04:00</updated>

		<published>2009-02-23T08:54:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87523#p87523</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87523#p87523"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87523#p87523"><![CDATA[
ahm... good point, thanks for the tip<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Mon Feb 23, 2009 8:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2009-02-23T03:43:08-04:00</updated>

		<published>2009-02-23T03:43:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87521#p87521</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87521#p87521"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87521#p87521"><![CDATA[
This line can cause incorrect behavior:<div class="codebox"><p>Code: </p><pre><code>set found [lsearch -glob "$user *" $lines]if {$found} {</code></pre></div>Since $found might return 0 if the index of the matched word is 0, the if statement will be processed as false rather than true. My suggestion is to add a check for the value of $found:<div class="codebox"><p>Code: </p><pre><code>if {$found != -1} {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Feb 23, 2009 3:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-21T12:44:38-04:00</updated>

		<published>2009-02-21T12:44:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87503#p87503</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87503#p87503"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87503#p87503"><![CDATA[
done<br><br>once again, thanks for the help, keep up the good job  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Sat Feb 21, 2009 12:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2009-02-21T05:39:21-04:00</updated>

		<published>2009-02-21T05:39:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87501#p87501</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87501#p87501"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87501#p87501"><![CDATA[
Initialize the array with an empty list<div class="codebox"><p>Code: </p><pre><code>array set users [list]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Feb 21, 2009 5:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-21T04:31:53-04:00</updated>

		<published>2009-02-21T04:31:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87500#p87500</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87500#p87500"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87500#p87500"><![CDATA[
I got an error with "array set": should be "array set arrayName list"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Sat Feb 21, 2009 4:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-20T19:25:52-04:00</updated>

		<published>2009-02-20T19:25:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87491#p87491</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87491#p87491"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87491#p87491"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set u_msg [lrange $split_words 1 end]</code></pre></div>This will work, it just add extra brackets.<br>But yeah, join can fix this "issue".<br><br>cheers<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Fri Feb 20, 2009 7:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-20T18:34:37-04:00</updated>

		<published>2009-02-20T18:34:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87489#p87489</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87489#p87489"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87489#p87489"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set u_msg [lrange $split_words 1 end] </code></pre></div>This is improper and special characters will cause problems with this line.<div class="codebox"><p>Code: </p><pre><code>set u_msg [join [lrange $split_words 1 end]] </code></pre></div>This is an easier way to achieve what your after.<div class="codebox"><p>Code: </p><pre><code>variable spam:chan "#yourchan"bind pub - !user spam:file:pubbind msg - !user spam:file:msgsetudef flag usersproc spam:file:msg {nick uhost hand text} {  spam:file:pub $nick $uhost $hand 0 $text}proc spam:file:pub {nick uhost hand chan text} {  if {[string equal "0" $chan]} {    set chan $nick  } elseif {![channel get $chan users]} { return }  set myfile [open "file.txt" r]  set whole_data [read $myfile]  close $myfile  set lines [split $whole_data "\n"]  set user [lindex [split $text] 0]  if {![string length $user]} {    set count 0 ; array set users    foreach line $lines {      if {[string length $line]} {        lappend users($count) [lindex [split $line] 0]        if {[llength $users($count)] &gt; 49} { incr count }      }    }    putserv "privmsg $chan :$::spam:chan users list:"    foreach count [array names users] {      putserv "privmsg $chan :[join [lsort -increasing $users($count)] ", "]"    }  } else {    set found [lsearch -glob "$user *" $lines]    if {$found} {      putserv "privmsg $chan :nick: [lindex [split [lindex $lines $found]] 0] -- message: [join [lrange [split [lindex $lines $found]] 1 end]]"    } else {      putserv "privmsg $chan :The nickname ($user) does not have a message attached."    }  }}</code></pre></div>What should happen here is the same procedure is used for both message and public binding. If the command is issued without any nickname to search for, the script will return all the nicknames (as your request 50 per line). If the command is issued with a nickname to search for, the script will return that nickname and their message.<br>on partyline, issue this command to turn the script on .chanset #yourchan +users<br>then you simply type <em class="text-italics">!users</em> and there is your list of users.<br>or type <em class="text-italics">!users nick</em> and if nick is there, his message will be shown or if it doesn't exist a message saying so will be shown instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Feb 20, 2009 6:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-20T13:48:07-04:00</updated>

		<published>2009-02-20T13:48:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87481#p87481</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87481#p87481"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87481#p87481"><![CDATA[
<blockquote class="uncited"><div>file:<div class="codebox"><p>Code: </p><pre><code>User1 Message1User2 Message2aUser3 Message1User2 Message2bUser3 Message3</code></pre></div>tcl:<div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"]# we are looking for User2set user_name "User2"foreach line $lines {        if {$line != ""} {                set split_words [split $line]                set u_nick [lindex $split_words 0]                set u_msg [lrange $split_words 1 end]                if {[string match *$user_name* $line]} {                        puts $u_msg                }        }}</code></pre></div>output:<div class="codebox"><p>Code: </p><pre><code>[tomekk@zonk]:/home# ./test.tclMessage2aMessage2b</code></pre></div>Format it as yourself.<br><br>And better make a bind something like this !user &lt;username&gt; will be easier for you than  !user2 !user3 etc.<br><br>cheers</div></blockquote>perfect!!! P-E-R-F-E-C-T!!! Thanks a lot <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Everything's fine by now, but I have one last problem which I didn't remember that could occur. The userlist is getting bigger and bigger, and when I type !userlist, the list is so big that it exceeds the maximum /notice command characters allowed.<br><br>Eg.: !userlist<br>[Fri-05:43:16pm] -@RoBotX- #cyber-world users list:<br>[Fri-05:43:17pm] -@RoBotX- &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; &lt;user&gt; AND FINISHED (the rest of them aren't showed because the notice is too big)<br><br>So my idea was to split the list in notices of 50 users maximum, I mean, the first notice with the first 50 users, 2nd notice with the other 50, etc, etc, till the listing ends. This seems very compilcated to me, I don't see what can I do to solve this :S<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Fri Feb 20, 2009 1:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-20T07:04:40-04:00</updated>

		<published>2009-02-20T07:04:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87475#p87475</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87475#p87475"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87475#p87475"><![CDATA[
file:<div class="codebox"><p>Code: </p><pre><code>User1 Message1User2 Message2aUser3 Message1User2 Message2bUser3 Message3</code></pre></div>tcl:<div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"]# we are looking for User2set user_name "User2"foreach line $lines {        if {$line != ""} {                set split_words [split $line]                set u_nick [lindex $split_words 0]                set u_msg [lrange $split_words 1 end]                if {[string match *$user_name* $line]} {                        puts $u_msg                }        }}</code></pre></div>output:<div class="codebox"><p>Code: </p><pre><code>[tomekk@zonk]:/home# ./test.tclMessage2aMessage2b</code></pre></div>Format it as yourself.<br><br>And better make a bind something like this !user &lt;username&gt; will be easier for you than  !user2 !user3 etc.<br><br>cheers<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Fri Feb 20, 2009 7:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-19T17:42:12-04:00</updated>

		<published>2009-02-19T17:42:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87468#p87468</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87468#p87468"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87468#p87468"><![CDATA[
Hi again,<br><br>Tested that, and the output was this (changed it to PRIVMSG $chan):<br><blockquote class="uncited"><div>[Thu-09:13:39pm] « @RoBotX » User1], Test], TestingUserlist]</div></blockquote>And then I noticed you added a useless ] in the "lappend" command, so here's the final and correct and tested script:<br><div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"]set users [list]foreach line $lines {   if {[string length $line]} {      lappend users [lindex [split $line] 0]   }}putserv "privmsg $nick :#yourchan users list:"putserv "privmsg $nick :[join $users ", "]"</code></pre></div>Thanks for the help speechles! Now, just need to fix the multiple messages issue. Any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Thu Feb 19, 2009 5:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-02-19T15:41:57-04:00</updated>

		<published>2009-02-19T15:41:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87467#p87467</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87467#p87467"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87467#p87467"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"] set users [list]foreach line $lines {if {[string length $line]} {lappend users [lindex [split $line] 0]]}}putserv "privmsg $nick :#yourchan users list:"putserv "privmsg $nick :[join $users ", "]"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Thu Feb 19, 2009 3:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-19T14:33:59-04:00</updated>

		<published>2009-02-19T14:33:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87465#p87465</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87465#p87465"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87465#p87465"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"]foreach line $lines {        if {$line != ""} {                set split_words [split $line]                set first_word [lindex $split_words 0]                puts $first_word        }}</code></pre></div>This can be one of many ways to do this.<br>Watch out for "spaces" in user names.  <br>If user name have "space" in name then you need to use other separate char like ";", will be easier. <br><br>User1;Message1 or something else</div></blockquote>Hi,<br><br>I replaced " puts $first_word" with "puthelp "NOTICE $nick $first_word"", because I prefer to send it via notice to the nickname that requested the listing. However, the list will be something like this:<br><blockquote class="uncited"><div>[Thu-05:12:38pm] -@RoBotX- #cyber-world users list:<br>[Thu-05:12:40pm] -@RoBotX- User1<br>[Thu-05:12:42pm] -@RoBotX- User2<br>[Thu-05:12:44pm] -@RoBotX- User3<br>[Thu-05:12:46pm] -@RoBotX- User4</div></blockquote>Whereas in fact I'd like it to be something like this:<blockquote class="uncited"><div>[Thu-05:12:38pm] -@RoBotX- #cyber-world users list:<br>[Thu-05:12:40pm] -@RoBotX- User1 User2 User3 User4</div></blockquote>Also, I'd like to ask you something else. If I have this file:<blockquote class="uncited"><div>User1 Message1<br>User2 Message2<br>User2 Message3<br>User2 Message4</div></blockquote>how would I make a process that sent message 2, then another with message 3 and finaly message4 to the channel when I type !user2 (I mean, make him read all lines with *User2* and send the messages to the channel).<br><br>Once again, thanks for the help and patience.<br><br>See ya<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Thu Feb 19, 2009 2:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-19T06:17:02-04:00</updated>

		<published>2009-02-19T06:17:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87461#p87461</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87461#p87461"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87461#p87461"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set myfile [open "file.txt" r]set whole_data [read $myfile]close $myfileset lines [split $whole_data "\n"]foreach line $lines {        if {$line != ""} {                set split_words [split $line]                set first_word [lindex $split_words 0]                puts $first_word        }}</code></pre></div>This can be one of many ways to do this.<br>Watch out for "spaces" in user names.  <br>If user name have "space" in name then you need to use other separate char like ";", will be easier. <br><br>User1;Message1 or something else<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Thu Feb 19, 2009 6:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fill]]></name></author>
		<updated>2009-02-18T17:00:13-04:00</updated>

		<published>2009-02-18T17:00:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87449#p87449</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87449#p87449"/>
		<title type="html"><![CDATA[Specific reading commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87449#p87449"><![CDATA[
Messing around with files and discovering new commands... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>My question now is, if I have a certain file, how would I make the bt read that file to the channel BUT only reading the first word of every line?<br><br>Example:<br><div class="codebox"><p>Code: </p><pre><code>File1.txt-----------User1 Message1User2 Message2User3 Message3</code></pre></div>And when typing !list, the bot sends this message to the channel:<br>User1, User2, User3<br><br>Thanks in advance,<br>Fill<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10430">Fill</a> — Wed Feb 18, 2009 5:00 pm</p><hr />
]]></content>
	</entry>
	</feed>
