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

	<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>2002-07-12T13:56:45-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-07-12T13:56:45-04:00</updated>

		<published>2002-07-12T13:56:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8828#p8828</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8828#p8828"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8828#p8828"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc pub:Cmds {nick uhost handle chan text} {  set misc1 [lindex [split $text] 0]  set misc2 [lrange [split $text] 1 end]  if {$misc1 == "country"} {    set chr [string tolower $misc2]    regsub -all -- { } $chr {_} chr     if {![info exists $country($chr)]} {      putserv "NOTICE $nick :Error: \002Country does not exist\002"      return 0    }    putserv "PRIVMSG $chan :$country($chr)"  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jul 12, 2002 1:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-12T12:18:16-04:00</updated>

		<published>2002-07-12T12:18:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8826#p8826</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8826#p8826"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8826#p8826"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc pub:Cmds {nick uhost handle chan text} {    set misc1    "[lindex $text 0]"    set misc2    "[lindex $text 1]"if {$misc1 == "country"} {    set chr [string tolower $misc2]    regsub -all -- { } $chr {_} chr     if {![info exists $country($chr)]} {    putserv "NOTICE $nick :Error: \002Country does not exist\002"    return 0    }    putserv "PRIVMSG $chan :$country($chr)"}}</code></pre></div><p>Statistics: Posted by Guest — Fri Jul 12, 2002 12:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-07-12T11:53:19-04:00</updated>

		<published>2002-07-12T11:53:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8824#p8824</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8824#p8824"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8824#p8824"><![CDATA[
Then the variable being passed only has the word south in it.<br><br>Seeing the rest of the script would help<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jul 12, 2002 11:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-12T11:25:30-04:00</updated>

		<published>2002-07-12T11:25:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8823#p8823</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8823#p8823"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8823#p8823"><![CDATA[
ok then fixed it but now getting...<br><br>[16:17] Tcl error [pub:Cmds]: can't read "country(south)": no such element in array<br><br>Sorry to be such a pain!!!!!   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"><p>Statistics: Posted by Guest — Fri Jul 12, 2002 11:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-07-12T10:27:55-04:00</updated>

		<published>2002-07-12T10:27:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8820#p8820</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8820#p8820"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8820#p8820"><![CDATA[
I have got the syntax of the regsub command mixed up.<br><br>It should actualy be<br><br>regsub ?switches? exp string subSpec varName<br><br>I got the exp and string the wrong way round<br><br>it should be<br><div class="codebox"><p>Code: </p><pre><code>proc de_spacer {str} {  regsub -all -- { } $str {_} str  return $str}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jul 12, 2002 10:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-12T09:15:08-04:00</updated>

		<published>2002-07-12T09:15:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8819#p8819</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8819#p8819"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8819#p8819"><![CDATA[
ok then so it should be.....<br><div class="codebox"><p>Code: </p><pre><code>if {$misc1 == "country"} {    set chr [string tolower $misc2]    set checkcountry [de_spacer $chr]    if {![info exists country($checkcountry)]} {    putserv "NOTICE $nick :Error: \002Country does not exist\002"    return 0    }    putserv "PRIVMSG $chan :$country($checkcountry)"}</code></pre></div><div class="codebox"><p>Code: </p><pre><code>proc de_spacer {str} {   regsub -all -- $str { } {_} str   return $str } </code></pre></div>Think thats right, but it dont work, keeps saying country does not exist...<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"><p>Statistics: Posted by Guest — Fri Jul 12, 2002 9:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-07-12T05:24:09-04:00</updated>

		<published>2002-07-12T05:24:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8815#p8815</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8815#p8815"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8815#p8815"><![CDATA[
the setting should be<br><div class="codebox"><p>Code: </p><pre><code>set country(south_africa) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div>In your script, as well as performing a [string] tolower command, your should run it through a de-spacer if you like.<br><div class="codebox"><p>Code: </p><pre><code>proc de_spacer {str} {  regsub -all -- $str { } {_} str  return $str}</code></pre></div>Once this is in the script, you can pass the country names through it, to convert them to array identifiers.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jul 12, 2002 5:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-11T19:11:08-04:00</updated>

		<published>2002-07-11T19:11:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8808#p8808</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8808#p8808"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8808#p8808"><![CDATA[
hmmmz.<br><br>Well this is wot im trying to do...<br><div class="codebox"><p>Code: </p><pre><code>if {$misc1 == "country"} {    set chr [string tolower $misc2]    if {![info exists country($chr)]} {    putserv "NOTICE $nick :Error: \002Country does not exist\002"    return 0    }    putserv "PRIVMSG $chan :$country($chr)"}</code></pre></div><br>Example of how the vars are set...<br><div class="codebox"><p>Code: </p><pre><code>set country(south africa) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div><div class="codebox"><p>Code: </p><pre><code>set country(za) "Country: \002South Africa\002 Code: \002ZA\002"</code></pre></div>So any ideas how i can do it using the underscores then?<p>Statistics: Posted by Guest — Thu Jul 11, 2002 7:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-07-11T18:46:03-04:00</updated>

		<published>2002-07-11T18:46:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8806#p8806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8806#p8806"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8806#p8806"><![CDATA[
spaces in variables == bad. a space is a core delimiter - using them in varible names will lead to problems later on. this is a core programming rule, which has been in effect ever since the concept of a named variable (or constant) was born. substitute your spaces for underscores (_)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Thu Jul 11, 2002 6:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-11T17:53:16-04:00</updated>

		<published>2002-07-11T17:53:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8805#p8805</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8805#p8805"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8805#p8805"><![CDATA[
I tried what you said an adding the '\' dont work, because it accepts it has 'south\ africa' not just 'south africa'    <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"> <br><br>Anymore ideas?<p>Statistics: Posted by Guest — Thu Jul 11, 2002 5:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-07-11T16:47:27-04:00</updated>

		<published>2002-07-11T16:47:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8798#p8798</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8798#p8798"/>
		<title type="html"><![CDATA[Re: Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8798#p8798"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>set country(south africa) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div></div></blockquote>Try escaping the space, like you have the control codes. EG<br><div class="codebox"><p>Code: </p><pre><code>set country(south\ africa) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div>Another method method includes<br><div class="codebox"><p>Code: </p><pre><code>set temp "south africa"set country($temp) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Jul 11, 2002 4:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-07-11T14:16:29-04:00</updated>

		<published>2002-07-11T14:16:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=8792#p8792</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=8792#p8792"/>
		<title type="html"><![CDATA[Tcl Problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=8792#p8792"><![CDATA[
I have been setting vars like this...<br><div class="codebox"><p>Code: </p><pre><code>set country(south africa) "Code: \002ZA\002 Country: \002South Africa\002"</code></pre></div>Then I find out that eggdrop dont like that.<br><br>Is there anyway around this with keeping the space?<br><br>Thanks<br>Jason<p>Statistics: Posted by Guest — Thu Jul 11, 2002 2:16 pm</p><hr />
]]></content>
	</entry>
	</feed>
