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

	<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>2012-09-07T15:21:15-04:00</updated>

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

		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2012-09-07T15:21:15-04:00</updated>

		<published>2012-09-07T15:21:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99991#p99991</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99991#p99991"/>
		<title type="html"><![CDATA[[SOLVED] help passing $data in array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99991#p99991"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc omgwtfnzb:brace { c data } {# array of colorsarray set cats {1 "\00307"2 "\00307"3 "\00306"4 "\00307"5 "\00307"6 "\00307"7 "\00306"8 "\00306"9 "\00303"10 "\00303"11 "\00303"12 "\00302"13 "\00302"14 "\00302"15 "\00308"16 "\00308"17 "\00308"18 "\00308"19 "\00311"20 "\00311"21 "\00311"22 "\00306"23 "\00313"}# Does the category exist?if {[info exists cats($c)]} {# yes - return formatted datareturn "$cats($c)\[$data\]\017"} else {# no - do nothing}}</code></pre></div>You only need to keep the part that changes inside your array. The rest can be tacked on during your return. This is a much simpler way to do it. ^_~<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Sep 07, 2012 3:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-09-07T09:01:51-04:00</updated>

		<published>2012-09-07T09:01:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99990#p99990</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99990#p99990"/>
		<title type="html"><![CDATA[[SOLVED] help passing $data in array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99990#p99990"><![CDATA[
cheers nml375 all works great now  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Fri Sep 07, 2012 9:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-09-07T13:27:10-04:00</updated>

		<published>2012-08-24T12:25:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99935#p99935</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99935#p99935"/>
		<title type="html"><![CDATA[[SOLVED] help passing $data in array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99935#p99935"><![CDATA[
In this case, you have to explicitly enforce variable substitutions.<br>There are a few ways to do this, though I believe this is the most secure approach:<div class="codebox"><p>Code: </p><pre><code>...foreach {catnum category} [array get cats] {  if {$iscat == $catnum} {    return [subst -nobackslashes -nocommands $category]  }}</code></pre></div>This way, we enforce the variable-substitution once we've extracted the correct template, and we explicitly block command and backslash substitutions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Aug 24, 2012 12:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-09-07T09:02:15-04:00</updated>

		<published>2012-08-24T10:56:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99934#p99934</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99934#p99934"/>
		<title type="html"><![CDATA[[SOLVED] help passing $data in array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99934#p99934"><![CDATA[
heres the proc<br><div class="codebox"><p>Code: </p><pre><code>proc omgwtfnzb:brace { c data } {set iscat $carray set cats {1 "\00307\[$data\]\017"2 "\00307\[$data\]\017"3 "\00306\[$data\]\017"4 "\00307\[$data\]\017"5 "\00307\[$data\]\017"6 "\00307\[$data\]\017"7 "\00306\[$data\]\017"8 "\00306\[$data\]\017"9 "\00303\[$data\]\017"10 "\00303\[$data\]\017"11 "\00303\[$data\]\017"12 "\00302\[$data\]\017"13 "\00302\[$data\]\017"14 "\00302\[$data\]\017"15 "\00308\[$data\]\017"16 "\00308\[$data\]\017"17 "\00308\[$data\]\017"18 "\00308\[$data\]\017"19 "\00311\[$data\]\017"20 "\00311\[$data\]\017"21 "\00311\[$data\]\017"22 "\00306\[$data\]\017"23 "\00313\[$data\]\017"}foreach { catnum catagorey } [array get cats] {if { $iscat == $catnum } {set return_cat $catagoreybreak}                      }return $return_cat}</code></pre></div>i use it in another proc like this <br><div class="codebox"><p>Code: </p><pre><code>puthelp "privmsg $info_chan :[omgwtfnzb:brace $x2 $x5] [omgwtfnzb:brace $x2 $x6] $info_baseurl$x1"</code></pre></div>x2 is $c and $x5, $x6 make up $data, the problem im having is when the proc is trigered it returns the word $data, and not the actual data.. if you get what i mean <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>the array works grat for the colours part, but this is what i cant get my head around..<br><br>channel output<div class="codebox"><p>Code: </p><pre><code>[$data] [$data] http://someurl.net</code></pre></div>i bet its a real simple solution too, but i cant figure it out   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Fri Aug 24, 2012 10:56 am</p><hr />
]]></content>
	</entry>
	</feed>
