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

	<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>2005-07-08T17:48:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-07-08T17:48:36-04:00</updated>

		<published>2005-07-08T17:48:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=52055#p52055</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=52055#p52055"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=52055#p52055"><![CDATA[
Thanks for the help guys. <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=2990">Solarin</a> — Fri Jul 08, 2005 5:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-07-02T08:45:31-04:00</updated>

		<published>2005-07-02T08:45:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51654#p51654</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51654#p51654"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51654#p51654"><![CDATA[
<blockquote class="uncited"><div>It won't matter if it contains brackets then</div></blockquote>exactly, unless you eval it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Jul 02, 2005 8:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2005-07-02T02:59:43-04:00</updated>

		<published>2005-07-02T02:59:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51647#p51647</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51647#p51647"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51647#p51647"><![CDATA[
It won't matter if it contains brackets then<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Sat Jul 02, 2005 2:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-07-01T18:08:46-04:00</updated>

		<published>2005-07-01T18:08:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51620#p51620</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51620#p51620"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51620#p51620"><![CDATA[
For example:<div class="codebox"><p>Code: </p><pre><code>set list { "bl[a]" "fo\o"}foreach bar $list { putlog $bar}</code></pre></div>this will putlog:<blockquote class="uncited"><div>bl[a]<br>foo</div></blockquote>but<div class="codebox"><p>Code: </p><pre><code>set list { {bl[a]} {fo\o}}foreach bar $list { putlog $bar}</code></pre></div>will putlog<blockquote class="uncited"><div>bl[a]<br>fo\o</div></blockquote>to putlog fo\o using the first, you should use "fo\\o" instead of "fo\o".<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri Jul 01, 2005 6:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-07-01T17:05:17-04:00</updated>

		<published>2005-07-01T17:05:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51619#p51619</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51619#p51619"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51619#p51619"><![CDATA[
what's the advantage of doing it that way?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Fri Jul 01, 2005 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awesomeawyeah]]></name></author>
		<updated>2005-06-26T09:10:30-04:00</updated>

		<published>2005-06-26T09:10:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51390#p51390</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51390#p51390"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51390#p51390"><![CDATA[
You can also use lists in this format, which is more better:<br><div class="codebox"><p>Code: </p><pre><code>set mylist {{my_element1}{my_element2}{my_element3}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6407">awesomeawyeah</a> — Sun Jun 26, 2005 9:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-06-23T03:33:55-04:00</updated>

		<published>2005-06-23T03:33:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51274#p51274</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51274#p51274"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51274#p51274"><![CDATA[
haha, omg.... we are all stupid to not notice this one earlier! we should be doomed!<br>you must escape the [] braces, but not because TCL tries to execute them, but because string match uses it like regexp, [fastshit] matchs any string containing a single f OR a OR s OR t  OR h OR i <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">. Just the - at the end prevents matching a bit, because it must match with a following - ^.^.<br><br><a href="http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm#M35" class="postlink">http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm#M35</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Thu Jun 23, 2005 3:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-06-23T01:36:32-04:00</updated>

		<published>2005-06-23T01:36:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51272#p51272</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51272#p51272"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51272#p51272"><![CDATA[
Ok I did some testing and this is what I found with the following code:<div class="codebox"><p>Code: </p><pre><code>set cv_bannednicks {[xxx][fastshit]-}...  set nick "[lindex [split $args " "] 6]"  set cv_host($nick) "[lindex [split $args " "] 8]"  foreach s $cv_bannednicks {   if {[string match -nocase *$s* $nick]} {     putlog "debug: would have banned *@$cv_host($nick) based on $s with $nick"    break;   }  }</code></pre></div>The output resulted with: <br>[01:34] (Botnickhere): [05:37] debug: would have banned *@censored.host.tmns.net.au based on [xxx] with mZ[SXCRXY]sad<br>[01:34] (Botnickhere): [05:37] debug: would have banned *@censored.host.gte.net based on [xxx] with cxhdxaes<br><br>I don't get it.  Can anyone help here?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Thu Jun 23, 2005 1:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-06-08T20:10:20-04:00</updated>

		<published>2005-06-08T20:10:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50438#p50438</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50438#p50438"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50438#p50438"><![CDATA[
Hmmm... well you are correct on the break; command.  I did not have that in there.  Thanks for that.  I had an oversight there.  However it is still 8 rather than 7.<br><br>As for the nick problem, it definitely has to do with string matching on an element of $cv_bannednicks.  What would you suggest from here?<br><br>Perhaps I should throw another nick in the list for test sake.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Wed Jun 08, 2005 8:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-06-08T19:33:24-04:00</updated>

		<published>2005-06-08T19:33:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50437#p50437</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50437#p50437"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50437#p50437"><![CDATA[
are you sure you broke the foreach loop after the first match?<br><blockquote class="uncited"><div>.loadtcl test<br>1: irc-ord<br>2: <a href="http://www.ircap.com" class="postlink">http://www.ircap.com</a><br>3: rbot<br>4: jrbot<br>5: <a href="http://iroffer.org/" class="postlink">http://iroffer.org/</a><br>6: xen0<br>7: sdbot<br>8: xdcc catcher basic<br>9: xdcc</div></blockquote>the list is proccessed smoothly here using your code (with putdcc 7 "$tempversionnumber: $s" after the incr invoaction).<br><br>for the nick thing... strange. from the code you posted it doesnt make sense at all. *[xxx]* cant match SeXy_BeBuLs_16. you accidently used join on a string while setting the nick (lindex returns a string, lrange returns a list ^^), but i doubt that was the problem.<br>same goes with my intention of using split \n<blockquote class="uncited"><div>.loadtcl test<br>firsttag<br>[tag2]<br>{tag3}<br>$tag4$<br>lasttag</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Wed Jun 08, 2005 7:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-06-08T17:20:33-04:00</updated>

		<published>2005-06-08T17:20:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50429#p50429</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50429#p50429"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50429#p50429"><![CDATA[
Ok... this is really starting to bother me.  Why don't my comparisons work correctly?<div class="codebox"><p>Code: </p><pre><code>set cv_bannedversions { "irc-ord" "http://www.ircap.com" "rbot" "jrbot" "http://iroffer.org/" "xen0" "sdbot" "xdcc catcher basic" "xdcc"}proc ctcp:version {nick uhost handle target key text} { set tempversionnumber 0... foreach s $cv_bannedversions {  if {[lsearch -glob [string tolower $text] "*$s*"] != -1} {...  }  incr tempversionnumber }}</code></pre></div>with a version of XDCC Catcher Basic, $tempversionnumber is 8 not 7 (which is "xdcc" not "xdcc catcher basic").  This indicates that spaces in the  element of $cv_bannedversions are making it choke up.<br><br>Furthermore, De Kus, the nick SeXy_BeBuLs_16 was banned with this code  instead of nicks with [xxx] in them (so any nick with x in it will be banned):<div class="codebox"><p>Code: </p><pre><code>set cv_bannednicks {[xxx]}...set cv_bannednicks [split $cv_bannednicks \n]...  set nick "[join [lindex [split $args " "] 6]]"  foreach s $cv_bannednicks {   if {[string match -nocase *$s* $nick]} {...   } }</code></pre></div>I haven't heard back in regards to this one yet.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Wed Jun 08, 2005 5:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-06-01T19:31:11-04:00</updated>

		<published>2005-06-01T19:31:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50094#p50094</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50094#p50094"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50094#p50094"><![CDATA[
That worked great.  Now if the bannednicks thing worked well with special nicks, I'd be set.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Wed Jun 01, 2005 7:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-06-01T17:48:59-04:00</updated>

		<published>2005-06-01T17:48:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50089#p50089</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50089#p50089"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50089#p50089"><![CDATA[
try<div class="codebox"><p>Code: </p><pre><code>set percent [expr {double($cv_banned) / $cv_count * 100}]</code></pre></div>or <div class="codebox"><p>Code: </p><pre><code>set percent [expr {($cv_banned) / ($cv_count + 0.0) * 100}]</code></pre></div>check out <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm" class="postlink">expr</a>.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Jun 01, 2005 5:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Solarin]]></name></author>
		<updated>2005-06-01T16:20:33-04:00</updated>

		<published>2005-06-01T16:20:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50085#p50085</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50085#p50085"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50085#p50085"><![CDATA[
They are incremented counters...<br><div class="codebox"><p>Code: </p><pre><code>set percent 0set tcl_precision 2set percent [expr $cv_banned / $cv_count * 100.00]putserv "PRIVMSG $chan :Banned $cv_banned hosts out of $cv_count clients ($percent%).</code></pre></div>That snippet is showing the following text in channel:<br>Banned 40 hosts out of 457 clients (0.0%).<br><br>Sorry... that was meant to be cv_banned instead of cv_klined for consistency sake.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2990">Solarin</a> — Wed Jun 01, 2005 4:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-06-01T15:56:40-04:00</updated>

		<published>2005-06-01T15:56:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50082#p50082</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50082#p50082"/>
		<title type="html"><![CDATA[using list in a foreach command]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50082#p50082"><![CDATA[
<blockquote class="uncited"><div>Furthermore, I still haven't heard anything from anyone regarding my expr problem:<div class="codebox"><p>Code: </p><pre><code>set percent 0set tcl_precision 2set percent [expr $cv_klined / $cv_count * 100.00]</code></pre></div>Why doesn't that return something (or why doesn't it return something other than 0)?</div></blockquote>what're $cv_klined and $cv_count ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Jun 01, 2005 3:56 pm</p><hr />
]]></content>
	</entry>
	</feed>
