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

	<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>2007-11-06T11:41:20-04:00</updated>

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

		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-06T11:41:20-04:00</updated>

		<published>2007-11-06T11:41:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77496#p77496</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77496#p77496"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77496#p77496"><![CDATA[
Again, works like a charm, thanks again!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Nov 06, 2007 11:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-11-06T11:35:16-04:00</updated>

		<published>2007-11-06T11:35:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77495#p77495</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77495#p77495"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77495#p77495"><![CDATA[
First thing, prefixing a variable with :: means addressing it with a full namespace path, in this case the global namespace :: (instead of using global cumulan).<br><br>I'd suggest you use two different variables, ::cumulan and ::cumulanreverse, define these in globalspace, and then use something like this:<div class="codebox"><p>Code: </p><pre><code>if {$reverse} { set map ::cumulanreverse} { set map ::cumulan}set output [string map [array get $map] $text]</code></pre></div>In this case, I use $map intentionally to hold the name of the array with the map, rather than entering the different array-names directly.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 06, 2007 11:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-06T11:14:55-04:00</updated>

		<published>2007-11-06T11:14:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77494#p77494</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77494#p77494"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77494#p77494"><![CDATA[
Alright, thanks :3<br>Unfortunately, I have another problem D:<div class="codebox"><p>Code: </p><pre><code>bind msg - "+cumulan"  spidey:cumulan#  a  b    c    d   e  f  g   h  i    j  k   l   m   n  o    p    q   r   s   t  u   v  w   x   y   z# aym mi korao hra ku zu gli ti gura bu upa yai gia tu kan guum yipa rur lia do zor qi wu omyr kil airuproc spidey:cumulan { nick host hand text } {global cumulanset reverse 0set verbose 0set chan ""set target ""if { [lindex [split $text] 0] == "-r" } {set reverse 1} else {set reverse 0}if { [lindex [split $text] 0] == "-v" } {set verbose 1set chan [lindex [split $text] 1]} else {set verbose 0}if { ([lindex [split $text] 0] == "-rv") || ([lindex [split $text] 0] == "-vr") } {set reverse 1set verbose 1set chan [lindex [split $text] 1]}if { !$reverse } {set cumulan(a) aymset cumulan(b) miset cumulan(c) koraoset cumulan(d) hraset cumulan(e) kuset cumulan(f) zuset cumulan(g) gliset cumulan(h) tiset cumulan(i) guraset cumulan(j) buset cumulan(k) upaset cumulan(l) yaiset cumulan(m) giaset cumulan(n) tuset cumulan(o) kanset cumulan(p) guumset cumulan(q) yipaset cumulan(r) rurset cumulan(s) liaset cumulan(t) doset cumulan(u) zorset cumulan(v) qiset cumulan(w) wuset cumulan(x) omyrset cumulan(y) kilset cumulan(z) airu} else {set cumulan(aym) aset cumulan(mi) bset cumulan(korao) cset cumulan(hra) dset cumulan(ku) eset cumulan(zu) fset cumulan(gli) gset cumulan(ti) hset cumulan(gura) iset cumulan(bu) jset cumulan(upa) kset cumulan(yai) lset cumulan(gia) mset cumulan(tu) nset cumulan(kan) oset cumulan(guum) pset cumulan(yipa) qset cumulan(rur) rset cumulan(lia) sset cumulan(do) tset cumulan(zor) uset cumulan(qi) vset cumulan(wu) wset cumulan(omyr) xset cumulan(kil) yset cumulan(airu) z}set output [string map [array get ::cumulan] $text]if { $verbose } {set output [lrange [split $output] 2 end]} elseif { $reverse } {set output [lrange [split $output] 1 end]}if { $verbose } {set method "PRIVMSG"set target $chan} else {set method "NOTICE"set target $nick}if { [catch { putserv "$method $target :$output" } errmsg] } {putserv "NOTICE $nick :\002Error:\002 $errmsg"}}putlog "Cumulan Translator 1.0 by Hen Asraf: Loaded"</code></pre></div>I need to code it to work both ways -- translate from one language to another. English to Cumulan works fine, but vice-versa doesn't work D: Any clue?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Nov 06, 2007 11:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-11-06T10:57:50-04:00</updated>

		<published>2007-11-06T10:57:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77493#p77493</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77493#p77493"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77493#p77493"><![CDATA[
Np, to see what further you can do using the "<a href="http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm" class="postlink">string</a>" command, and others, <a href="http://www.tcl.tk/man/tcl8.4/" class="postlink">have a look at the manual</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 06, 2007 10:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-06T10:38:29-04:00</updated>

		<published>2007-11-06T10:38:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77492#p77492</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77492#p77492"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77492#p77492"><![CDATA[
Alright! Works like a charm <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br>Thanks again ^_^<br>Just shows I still have alot to learn <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=8949">dokueki</a> — Tue Nov 06, 2007 10:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-11-06T10:32:17-04:00</updated>

		<published>2007-11-06T10:32:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77491#p77491</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77491#p77491"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77491#p77491"><![CDATA[
Ahh... my bad, should've been ::substitute rather than $::substitute<br><br>Updating my previous post aswell..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 06, 2007 10:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-06T10:30:59-04:00</updated>

		<published>2007-11-06T10:30:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77490#p77490</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77490#p77490"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77490#p77490"><![CDATA[
Well, it says it can't read the variable cause it's an array:<br>(cumulan = substitute)<br><strong class="text-strong">[16:26] Tcl error [spidey:cumulan]: can't read "::cumulan": variable is array</strong><br><br>This is after I used global to make it accessible. Without using global, it says it doesn't exist, and without referring to it as global (::), it gives the same error as the one above D:<br><br>Thanks again for the help, btw.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Nov 06, 2007 10:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-11-06T10:33:14-04:00</updated>

		<published>2007-11-06T10:12:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77487#p77487</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77487#p77487"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77487#p77487"><![CDATA[
That's usually an indication that your list is not properly ordered.<br><br>One more intuitive way of creating the substitution-list is by doing it something like this:<div class="codebox"><p>Code: </p><pre><code>set substitute(a) aymset substitute(b) miset substitute(c) korao......[string map [array get ::substitute] $text]...</code></pre></div>Also, the list you provided in your post works just fine for me, double-check that you don't have any unexpected spaces or characters within your list (somewhere between "ku" and "f", as it seems this is the location where your list seems to be "offset'd")<br><br>edit:<br>Clumsy me, should've learned to know when to use $ and not by now :p<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 06, 2007 10:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-06T08:18:33-04:00</updated>

		<published>2007-11-06T08:18:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77483#p77483</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77483#p77483"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77483#p77483"><![CDATA[
Woo, that was great help. I didn't know you could use string map with a list like that. Anyways, I tried it, and it works fine, until it stops replacing characters after the fifth time. I mean, +cumulan abcde works, but beyond that, it'll only replace upto e and then start outputting the following chars without replacing them.<br><br><strong class="text-strong">[02:12:35 PM] &lt;Spidey&gt; +cumulan abcdefghijklmnopqrstuvwxyz<br>[02:12:38 PM] [Notice] -Venom- abcdefghijklmnopqrstuvwxyz = aymmikoraohrakufghijklmnopqrstuvwxyz<br>[02:17:49 PM] &lt;Spidey&gt; +cumulan this is a test<br>[02:17:52 PM] [Notice] -Venom- this is a test = this is aym tkust</strong><div class="codebox"><p>Code: </p><pre><code>bind msg - "+cumulan"  spidey:cumulan#  a  b    c    d   e  f  g   h  i    j  k   l   m   n  o    p    q   r   s   t  u   v  w   x   y   z# aym mi korao hra ku zu gli ti gura bu upa yai gia tu kan guum yipa rur lia do zor qi wu omyr kil airuproc spidey:cumulan { nick host hand text } {if { [lindex [split $text] 0] == "-r" } {} else {set output [string map [list a aym b mi c korao d hra e ku f zu g gli h ti i gura j bu k upa l yai m gia n tu o kan p guum q yipa r rur s lia t do u zor v qi w wu x omyr y kil z airu] $text]}putserv "NOTICE $nick :$text = $output"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Nov 06, 2007 8:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-11-06T05:43:44-04:00</updated>

		<published>2007-11-06T05:43:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77482#p77482</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77482#p77482"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77482#p77482"><![CDATA[
First off, foreach expects a list, not a string. Big difference!<br><br>Secondly, why do you use the foreach-loop there anyway? You never try to use $item anywhere within the loop. Don't use foreach as a normal for-loop, but use "for" for this (or "while").<br><br>Third, all you seem to do is alot of string map's, why not simply create one large map-list, and allow "string map" to work on the whole string at once?<br><br>Such as something like this...<div class="codebox"><p>Code: </p><pre><code>... puthelp "NOTICE $nick :$text = [string map [list a aym b mi c korao d hra e ku ...] $text]"...</code></pre></div>Fourth, the only string map that will have any effect in the end of your code is the last (string map { "z" "airu" }), as the output stored in $newchar from previous string map's will be overwritten by this...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Nov 06, 2007 5:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2007-11-05T20:33:32-04:00</updated>

		<published>2007-11-05T20:33:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77479#p77479</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77479#p77479"/>
		<title type="html"><![CDATA[Logic Error - Replacing Characters in a String]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77479#p77479"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - "+cumulan"  spidey:cumulan#  a  b    c    d   e  f  g   h  i    j  k   l   m   n  o    p    q   r   s   t  u   v  w   x   y   z# aym mi korao hra ku zu gli ti gura bu upa yai gia tu kan guum yipa rur lia do zor qi wu omyr kil airuproc spidey:cumulan { nick host hand chan text } {if { [lindex [split $text] 0] == "-r" } {} else {set i 0set output ""foreach item [string range $text 0 end] { set newchar [string map { "a" "aym" } [string index $text $i]]set newchar [string map { "b" "mi" } [string index $text $i]]set newchar [string map { "c" "korao" } [string index $text $i]]set newchar [string map { "d" "hra" } [string index $text $i]]set newchar [string map { "e" "ku" } [string index $text $i]]set newchar [string map { "f" "zu" } [string index $text $i]]set newchar [string map { "g" "gli" } [string index $text $i]]set newchar [string map { "h" "ti" } [string index $text $i]]set newchar [string map { "i" "gura" } [string index $text $i]]set newchar [string map { "j" "bu" } [string index $text $i]]set newchar [string map { "k" "upa" } [string index $text $i]]set newchar [string map { "l" "yai" } [string index $text $i]]set newchar [string map { "m" "gia" } [string index $text $i]]set newchar [string map { "n" "tu" } [string index $text $i]]set newchar [string map { "o" "kan" } [string index $text $i]]set newchar [string map { "p" "guum" } [string index $text $i]]set newchar [string map { "q" "yipa" } [string index $text $i]]set newchar [string map { "r" "rur" } [string index $text $i]]set newchar [string map { "s" "lia" } [string index $text $i]]set newchar [string map { "t" "do" } [string index $text $i]]set newchar [string map { "u" "zor" } [string index $text $i]]set newchar [string map { "v" "qi" } [string index $text $i]]set newchar [string map { "w" "wu" } [string index $text $i]]set newchar [string map { "x" "omyr" } [string index $text $i]]set newchar [string map { "y" "kil" } [string index $text $i]]set newchar [string map { "z" "airu" } [string index $text $i]]set output "$output$newchar"incr i}}putserv "NOTICE $nick :$text = $output"}</code></pre></div>What I'm trying to do here, is make it replace each letter with several other letters, creating a fake, code language.<br>But all it does is just delete some chars and only keeping the first several/one char in there. I dunno what's happening, so I came to the forums as a last result. Any help on this would be greatly appreciated!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Mon Nov 05, 2007 8:33 pm</p><hr />
]]></content>
	</entry>
	</feed>
