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

	<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-03-14T19:56:25-04:00</updated>

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

		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-03-14T19:55:52-04:00</updated>

		<published>2005-03-14T19:55:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47666#p47666</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47666#p47666"/>
		<title type="html"><![CDATA[problem with switch [solved] now really ^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47666#p47666"><![CDATA[
okay, the last one now really helped (even improoven readability again <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">).<br>I finally got through, here the proof:<blockquote class="uncited"><div>[00:54:09] #De_Kus# set europingloki<br>Currently: 3004</div></blockquote>this is normaly 0 if the switch doesn't save the expr and clock feedback <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.<br><div class="codebox"><p>Code: </p><pre><code>switch $ip \$::euroipchaos {set ::eurostatuschaos 1} \$::euroiploki {set ::eurostatusloki 1}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon Mar 14, 2005 7:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-03-14T19:38:29-04:00</updated>

		<published>2005-03-14T19:38:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47665#p47665</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47665#p47665"/>
		<title type="html"><![CDATA[Re: problem with switch]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47665#p47665"><![CDATA[
<blockquote class="uncited"><div>The switch command can match against variables and not just literals, as shown here</div></blockquote>Heh..that's a weird thing to say... The switch command can match against strings, not variables...variable substitution is performed BEFORE switch recieves the values, so that manual comment is a bit misleading.<br>Btw: you can still add whitespace between the braces to avoid having your entire switch on a single, unreadable line:<div class="codebox"><p>Code: </p><pre><code>switch -- $a \$b {...} $c {...} default {...}</code></pre></div>You missed the "string" part of your statement...and btw: to get a little less verbose bgerrors, (and have them displayed when they occur) make a proc called bgerror that takes a single argument and displays the contents on the partyline or whatever...<br>eg <div class="codebox"><p>Code: </p><pre><code>proc bgerror a {putlog "BGERR: $a"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Mar 14, 2005 7:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-03-14T19:47:40-04:00</updated>

		<published>2005-03-14T19:37:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47664#p47664</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47664#p47664"/>
		<title type="html"><![CDATA[problem with switch [solved] now really ^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47664#p47664"><![CDATA[
okay, that was a bit early... when I took a close look, I cannot get rid of this error now:<blockquote class="uncited"><div>[00:34:25] #De_Kus# set errorInfo<br>Currently: invalid command name "bgerror"<br>Currently:     while invoking<br>Currently: "unknown bgerror wrong # args: should be "switch ?switches? string pattern body ..."</div></blockquote><div class="codebox"><p>Code: </p><pre><code>switch [list $ip $::euroipchaos {set ::eurostatuschaos 1} $::euroiploki {set ::eurostatusloki 1}]</code></pre></div>did I understand something wrong again? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>list seems not to be the problem, looks like its doing its job:<blockquote class="uncited"><div>set list [list $ip $::euroipchaos {set ::eurostatuschaos 1} $::euroiploki {set ::eurostatusloki 1}]<br>for {set i 0} {$i &lt; [llength $list]} {incr i} {<br>putdcc 12 [lindex $list $i]<br>}<br>--&gt;<br>62.109.138.134<br>62.109.138.134<br>set ::eurostatuschaos 1<br>62.109.138.138<br>set ::eurostatusloki 1</div></blockquote>if i leave out <ul> <li>it seems to work</li></ul><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon Mar 14, 2005 7:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-03-14T19:21:44-04:00</updated>

		<published>2005-03-14T19:21:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47662#p47662</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47662#p47662"/>
		<title type="html"><![CDATA[Re: problem with switch]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47662#p47662"><![CDATA[
<blockquote class="uncited"><div>According to <a href="http://tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M10" class="postlink">http://tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M10</a> variable substitution is not performed between braces <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br>try something like this <div class="codebox"><p>Code: </p><pre><code>switch -- whatever [list $var {code} $var2 {code} default {code}]</code></pre></div> instead.</div></blockquote>I only read this <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><blockquote class="uncited"><div>The switch command can match against variables and not just literals, as shown here (the result is 2):<br><br>set foo "abc"<br>switch abc a - b {expr 1} $foo {expr 2} default {expr 3}</div></blockquote>but to say it in short... user, you are my hero! that helped <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=2382">De Kus</a> — Mon Mar 14, 2005 7:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-03-14T19:09:51-04:00</updated>

		<published>2005-03-14T19:09:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47661#p47661</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47661#p47661"/>
		<title type="html"><![CDATA[Re: problem with switch]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47661#p47661"><![CDATA[
<blockquote class="uncited"><div>according to <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm" class="postlink">http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm</a> this statement looks perfectly fine for me.</div></blockquote>According to <a href="http://tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M10" class="postlink">http://tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M10</a> variable substitution is not performed between braces <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br>try something like this <div class="codebox"><p>Code: </p><pre><code>switch -- whatever [list $var {code} $var2 {code} default {code}]</code></pre></div> instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Mar 14, 2005 7:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-03-14T19:56:25-04:00</updated>

		<published>2005-03-14T19:03:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47660#p47660</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47660#p47660"/>
		<title type="html"><![CDATA[problem with switch [solved] now really ^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47660#p47660"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set ip [lindex [fconfigure $sock -peername] 0]putdcc 12 "'$ip' '$::euroipchaos' '$::euroiploki'"if { [fconfigure $sock -error] == "" } {switch $ip {$::euroipchaos {set ::eurostatuschaos 1putdcc 12 "status chaos"}$::euroiploki {set ::eurostatusloki 1putdcc 12 "status loki"}default {putdcc 12 "noob"}}}</code></pre></div>this is called on fileevent twice in a row each for the other ip.<br>here the partyline log caused by the debug code:<blockquote class="uncited"><div>'62.109.138.138' '62.109.138.134' '62.109.138.138'<br>noob<br>'62.109.138.134' '62.109.138.134' '62.109.138.138'<br>noob</div></blockquote>according to <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm" class="postlink">http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm</a> this statement looks perfectly fine for me. I also tried to use ${::euroipchaos} which won't change anything. I also tried to use the variable via global and without :: within the switch structure, but still no change... it still calls default <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad">.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon Mar 14, 2005 7:03 pm</p><hr />
]]></content>
	</entry>
	</feed>
