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

	<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-05-03T04:24:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-05-03T04:24:48-04:00</updated>

		<published>2005-05-03T04:24:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48931#p48931</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48931#p48931"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48931#p48931"><![CDATA[
you should make the whole array global, not just 1 element.<br><br>global command<br><br>should be fine (remember my example "global chan_trigger global chan_greeting ")?!<br><br>btw. you can assemble array elemets together like:<br><br>command($chan:trigger)<br>command($chan:greeting)<br>...<br><br>this way you would only need 1 array for everything in the script ^-^.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Tue May 03, 2005 4:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-02T20:41:30-04:00</updated>

		<published>2005-05-02T20:41:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48925#p48925</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48925#p48925"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48925#p48925"><![CDATA[
Alright , fixed it! But another problem : /<br><div class="codebox"><p>Code: </p><pre><code>proc command:main {nick uhost hand chan arg} { global chan_trigger set command "[string range $arg 1 end]" global command($chan) putlog "${command}($chan)" if {[info exist command($chan)]} {    putnotc $nick "$command($chan)"  }}</code></pre></div>its giving me <br><br>Its not giving me an error or anything its just not outputing any data.. anyone know why?  <br><br>I type @commands, so it should search for a variable called $commands($chan) and output the data the that variable has. Its not doing that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Mon May 02, 2005 8:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-02T17:53:54-04:00</updated>

		<published>2005-05-02T17:53:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48919#p48919</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48919#p48919"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48919#p48919"><![CDATA[
What difference does it make ? just put the global line in the appropriate place and it should not cause problems.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon May 02, 2005 5:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-02T16:45:13-04:00</updated>

		<published>2005-05-02T16:45:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48917#p48917</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48917#p48917"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48917#p48917"><![CDATA[
Ok, I found the problem.. <br>chan_trigger is acting as an array. I have more than one thing set in that array. But is there a way I can make it so it wont act as an array using chan_trigger() ? I want a seprate variable for every chan_trigger($chan). Any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Mon May 02, 2005 4:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-05-02T16:18:53-04:00</updated>

		<published>2005-05-02T16:18:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48914#p48914</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48914#p48914"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48914#p48914"><![CDATA[
For adding information into a MySql database you have to enclose it inside '$quotes' So his script is correct on the MySql side.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Mon May 02, 2005 4:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-05-02T14:52:38-04:00</updated>

		<published>2005-05-02T14:52:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48902#p48902</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48902#p48902"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48902#p48902"><![CDATA[
you are using global the wrong place. the var outside of the proc is always global, so using global is redudant. you need to use it within the proc command:main:set before used the first time, so you usually you set a global line at the beginning of the proc like:<br>global chan_trigger global chan_greeting<br><br>if that doesnt help:<br>have you confirmed $current_chan_name contains the chan name without any quotes? I know SQL likes to use single quotes, but TCL uses double quotes or curly bracets.<br>i mean this behavior:<blockquote class="uncited"><div>tcl: evaluate (.tcl): lindex {"1" "2" "3"} 1<br>Tcl: 2<br>tcl: evaluate (.tcl): lindex {'1' '2' '3'} 1<br>Tcl: '2'</div></blockquote>I don't know SQL very well, but if you would save as chan_trigger('#channel') and try to load as chan_trigger(#channel) the error would make sense <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.<br><br>PS: I wouldn't use string tolower, just use this for comparation:<br>if { [string equal -nocase $a $b] } ...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon May 02, 2005 2:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-02T14:34:26-04:00</updated>

		<published>2005-05-02T14:34:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48901#p48901</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48901#p48901"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48901#p48901"><![CDATA[
rofl, alright nothing seems to be working, I've tried everything. here is my whole code for the functions:<br><div class="codebox"><p>Code: </p><pre><code>bind pubm -|- *  command:main:set### set chan varsset get_chan_name [mysql_query "SELECT * FROM bot_channels"]putlog "*** SETTING CHANNEL VARIABLES ***"foreach row $get_chan_name {       set current_chan_name "[lindex $row 1]"       set current_chan_trigger "[lindex $row 3]"       set current_chan_greeting "[lindex $row 4]"       putlog "^B^_Starting $current_chan_name vars^_^B"       global chan_trigger($current_chan_name)       global chan_greeting($current_chan_name)       set chan_trigger([string tolower $current_chan_name]) [lindex $row 3]       putlog "Set $current_chan_name ^Btrigger^B to '$current_chan_trigger'"       set chan_greeting([string tolower $current_chan_name]) [lindex $row 4]       putlog "Set $current_chan_name ^Bgreeting^B to '$current_chan_greeting'"       set get_chan_commands [mysql_query "SELECT * FROM bot_commands WHERE command_chan='$current_chan_name'"]       foreach row2 $get_chan_commands {              set [lindex $row2 1]([string tolower $current_chan_name]) "[lindex $row2 2]"              putlog "Set $current_chan_name command ^B[lindex $row2 1]^B to '[lindex $row2 2]'"       }}### MAIN SET FUNCTION ###proc command:main:set {nick uhost hand chan arg} {  if {[string tolower [lindex [split $arg] 0]] == "${chan_trigger($chan)}set" &amp;&amp; [string tolower [lindex $arg 1]] == "greeting"} {        if {[isop $nick $chan]} {                set greeting "[lrange $arg 2 end]"                putnotc $nick "Set Greeting to '$greeting'"              } else {                putnotc $nick "Error(1): You lack access to 'set greeting'"                putnotc $nick "Error(2): Unable to 'set greeting'"              }        } elseif {[string tolower [lindex [split $arg] 0]] == "${chan_trigger($chan)}set" &amp;&amp; [string  tolower [lindex $arg 1]] == "trigger"} {                if {[isop $nick $chan]} {                        set new_trigger "[lrange $arg 2 end]"                        set save_trigger [mysql_query "UPDATE bot_channels SET chan_trigger='$new_trigger'"]                        putnotc $nick "Set channel trigger to '$new_trigger'"                } else {                         putnotc $nick "Error(1): You lack access to 'set trigger'"                        putnotc $nick "Error(2):  Unable to set 'trigger'"                }        } elseif {[string tolower [lindex [split $arg] 0]] == "${chan_trigger($chan)}set"} {                if {[isop $nick $chan]} {                        set command_input [string tolower [lindex $arg 1]]                        set command_input_value  "[lrange $arg 2 end]"                        set result [mysql_query "SELECT command_name FROM bot_commands WHERE command_chan='$chan' &amp;&amp; command_name='${command_input}'"]                                if {[info exist result]} {                                        foreach row $result {                                                foreach element $row {                                                        set update_command [mysql_query "UPDATE bot_commands SET command_value='${command_input_value}'"]                                                        putnotc $nick "Set $command_input to '$command_input_value'"                                                    }                                                }                                            } else {                                                set insert_command [mysql_query "INSERT INTO bot_commands (command_chan, command_name, command_value) VALUES ('$chan', '$command_input', '$command_input_value'"]                                                putnotc $nick "Set $command_input to $command_input_value"                                            }                                        } else {                                            putnotc $nick "Error(1): You lack access to 'set $command_input'"                                            putnotc $nick "Error(2): Unable to 'set $command_input'"                                        }                                    }                                }</code></pre></div>This is a new error I am getting, I completley restarted the bot. I know it has something do with the ==  "$chan_trigger($chan)" part in the main set proc. I've tried $chan_trigger(${chan}) That didnt really help at all:<br><br><br>[14:33] Tcl error [command:main:set]: can't read "chan_trigger($chan)": no such element in array<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Mon May 02, 2005 2:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-02T13:43:01-04:00</updated>

		<published>2005-05-02T13:43:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48898#p48898</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48898#p48898"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48898#p48898"><![CDATA[
There might be a conflict with cases. If #channel is lower case, then I suggest yo do: set chan_trigger([string tolower $chan_name]) [lindex $row 3]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon May 02, 2005 1:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-02T13:24:11-04:00</updated>

		<published>2005-05-02T13:24:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48896#p48896</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48896#p48896"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48896#p48896"><![CDATA[
No.. the on load event sets the variables like so $chan_trigger(#mychannel) so therefore in the command I should use $chan_trigger($chan) to get the channel. But its not working. I posted the exact error message that I got from telnet.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Mon May 02, 2005 1:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-05-02T12:21:42-04:00</updated>

		<published>2005-05-02T12:21:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48893#p48893</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48893#p48893"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48893#p48893"><![CDATA[
you should post more details about where that error happens, if you expect any help from us ^-^.<br><br>but should you be using something like that now?<br>set chan_trigger($chan_name) [lindex $row 3]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon May 02, 2005 12:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-02T09:40:18-04:00</updated>

		<published>2005-05-02T09:40:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48884#p48884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48884#p48884"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48884#p48884"><![CDATA[
Yup, I made it global, still doesnt work. ; /<br><br><br>[09:38] Tcl error [command:main:set]: can't read "chan_trigger": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Mon May 02, 2005 9:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-05-02T03:54:32-04:00</updated>

		<published>2005-05-02T03:54:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48860#p48860</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48860#p48860"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48860#p48860"><![CDATA[
forgot to make the var global? did you think of that the var might not be always initialized before first use?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon May 02, 2005 3:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-01T21:57:06-04:00</updated>

		<published>2005-05-01T21:57:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48849#p48849</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48849#p48849"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48849#p48849"><![CDATA[
Thanks man, didnt really relize I was doin that. But uhh anyways: is this correct? <br><br>  if {[string tolower [lindex [split $arg] 0]] == "${chan_trigger($chan)}set" &amp;&amp; [string tolower [lindex $arg 1]] == "greeting"} { <br><br>Its saying the $chan_trigger($chan) is not set when I know it set when I ran the script cause it says it set. <br><br>Anyideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Sun May 01, 2005 9:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-05-01T18:29:09-04:00</updated>

		<published>2005-05-01T18:29:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48848#p48848</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48848#p48848"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48848#p48848"><![CDATA[
you can't set chan_trigger($chan_name) and chan_greeting($chan_name) since you already have set chan_trigger and chan_greeting, I suggest you erase the first sets, and set them directly to the arrays.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun May 01, 2005 6:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[daltonc]]></name></author>
		<updated>2005-05-01T17:55:58-04:00</updated>

		<published>2005-05-01T17:55:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=48843#p48843</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=48843#p48843"/>
		<title type="html"><![CDATA[Variable questions]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=48843#p48843"><![CDATA[
Mmmmm... didnt work. This is my actual code:<br><div class="codebox"><p>Code: </p><pre><code>set get_chan_name [mysql_query "SELECT * FROM bot_channels"]putlog "*** SETTING CHANNEL VARIABLES ***"foreach row $get_chan_name {        set chan_name "[lindex $row 1]"       set chan_trigger "[lindex $row 3]"       set chan_greeting "[lindex $row 4]"       set chan_trigger($chan_name) "$chan_trigger"       putlog "Set $chan_name trigger to $chan_trigger"       set chan_greeting($chan_name) "$chan_greeting"}</code></pre></div>this is my error:<br><br>[17:54] can't set "chan_trigger(#testchannel)": variable isn't array<br>    while executing<br>"set chan_trigger($chan_name) "$chan_trigger""<br>    ("foreach" body line 6)<br>    invoked from within<br>"foreach row $get_chan_name {<br>        set chan_name "[lindex $row 1]"<br>       set chan_trigger "[lindex $row 3]"<br>       set chan_greeting "[lindex $row ..."<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6153">daltonc</a> — Sun May 01, 2005 5:55 pm</p><hr />
]]></content>
	</entry>
	</feed>
