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

	<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>2003-10-29T19:54:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[smds]]></name></author>
		<updated>2003-10-29T19:54:07-04:00</updated>

		<published>2003-10-29T19:54:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29169#p29169</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29169#p29169"/>
		<title type="html"><![CDATA[foreach problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29169#p29169"><![CDATA[
Had a look over i again and again, and still dont see the problem,<br>i did add another close brace to close that if, but then got<br>an error about '"chan" no such var'<br>this code isnt mine anyway, so i dont fully understand it<br>i know the basics, but heres the code as i have it un edited.<br><div class="codebox"><p>Code: </p><pre><code>proc chanflags {nick mask hand chan arg} { set arg [split [join $arg] " "] set av "" set tl "" set flag [lindex $arg 0] set mode "" foreach cf [split $flag ""] {  if {$cf == "+"} {   set mode $cf  }  if {$cf == "-"} {   set mode $cf  }  if {$mode == "+"} {   switch -- $cf {    "v" { code...    }    "t" { code...    }    }   }  } elseif {$mode == "-"} {   switch -- $cf {    "v" { code...    }    "t" { code...    }    }   }  } } if {[string match *+voiceall* [channel info $chan]]} {set av "v"} if {[string match *+topiclock* [channel info $chan]]} {set tl "t"} if {$flag == ""} {puthelp "NOTICE $nick :chanflags: $tl$av"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3848">smds</a> — Wed Oct 29, 2003 7:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-29T18:12:58-04:00</updated>

		<published>2003-10-29T18:12:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29166#p29166</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29166#p29166"/>
		<title type="html"><![CDATA[foreach problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29166#p29166"><![CDATA[
<blockquote class="uncited"><div>nope, still cant see it  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"></div></blockquote>You need to understand how the tcl interpreter defines "words" or arguments passed to the commands to fully understand this. (read and understand this entire page: <a href="http://tcl.tk/man/tcl8.4/TclCmd/Tcl.htm" class="postlink">http://tcl.tk/man/tcl8.4/TclCmd/Tcl.htm</a> )<br><br>You've misplaced a } (meant for one of your ifs) and made the 'elseif' part (including the word 'elseif') of that 'if' become arguments passed to foreach. In your code, 6 arguments are passed to 'foreach' and that doesn't work because foreach expects an odd number of arguments (pairs of variable names/values + a command).<br><br>Notice how foreach lines up with '} elseif {...' when proper indentation is applied. (my previous post)<br>Check those braces one more time.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Oct 29, 2003 6:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[smds]]></name></author>
		<updated>2003-10-29T17:48:19-04:00</updated>

		<published>2003-10-29T17:48:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29163#p29163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29163#p29163"/>
		<title type="html"><![CDATA[foreach problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29163#p29163"><![CDATA[
nope, still cant see it  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3848">smds</a> — Wed Oct 29, 2003 5:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-29T17:37:45-04:00</updated>

		<published>2003-10-29T17:37:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29162#p29162</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29162#p29162"/>
		<title type="html"><![CDATA[foreach problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29162#p29162"><![CDATA[
With proper indentation you'd notice the problem I think <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br>Take a close look at your code:<div class="codebox"><p>Code: </p><pre><code>proc something {nick mask hand chan arg} { set arg [split [join $arg] " "] set av "" set tl "" set flag [lindex $arg 0] set mode "" foreach cf [split $flag ""] {if {$cf == "+"} { set mode $cf } if {$cf == "-"} { set mode $cf } if {$mode == "+"} { switch -- $cf { "v" { code... } "t" { code... } } } } elseif {$mode == "-"} { switch -- $cf { "v" { code... } "t" { code... } } } code... } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Oct 29, 2003 5:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[smds]]></name></author>
		<updated>2003-10-29T17:16:16-04:00</updated>

		<published>2003-10-29T17:16:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29158#p29158</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29158#p29158"/>
		<title type="html"><![CDATA[foreach problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29158#p29158"><![CDATA[
keep getting this error:<br>wrong # args: should be "foreach varList list ?varList list ...? command"<br>while executing this code:<br><div class="codebox"><p>Code: </p><pre><code>proc something {nick mask hand chan arg} { set arg [split [join $arg] " "] set av "" set tl "" set flag [lindex $arg 0] set mode "" foreach cf [split $flag ""] {  if {$cf == "+"} {   set mode $cf  }  if {$cf == "-"} {   set mode $cf  }  if {$mode == "+"} {   switch -- $cf {    "v" {          code...    }    "t" {          code...    }    }   }  } elseif {$mode == "-"} {   switch -- $cf {    "v" {          code...    }    "t" {          code...    }    }   }code...}</code></pre></div>im either going blind, or have been looking at it for too long,<br>just cant see the problem. rest of the code is fine, just the foreach<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3848">smds</a> — Wed Oct 29, 2003 5:16 pm</p><hr />
]]></content>
	</entry>
	</feed>
