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

	<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>2004-04-28T22:14:18-04:00</updated>

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

		<entry>
		<author><name><![CDATA[collett9]]></name></author>
		<updated>2004-04-28T22:14:18-04:00</updated>

		<published>2004-04-28T22:14:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35946#p35946</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35946#p35946"/>
		<title type="html"><![CDATA[if no variable is set]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35946#p35946"><![CDATA[
k, I kind of get where you are coming from, but let me go into greater detail to help YOU help ME even easier. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>- my variables are in a file called vars.tcl (in the scripts folder)<br><br><br>Here is what the code looks like in my vars.tcl<br><div class="codebox"><p>Code: </p><pre><code># set variableset variwannaset "default set"</code></pre></div><br>Here is how I have it laid out:<br><div class="codebox"><p>Code: </p><pre><code>proc saveVars {vars.tcl nick} {    set f [open $file w]    set i 0    foreach var $args {       upvar 1 $var [incr i]       if {[array exists $i]} {          puts $f [list array set $var [array get $i]]       } elseif {[info exists $i]} {          puts $f [list set $var [set $i]]       }    }    close $f }proc loadVars file {uplevel 1 [list source scripts/$file]}</code></pre></div>and here is the actual command:<br><div class="codebox"><p>Code: </p><pre><code>proc cmd:setvar {nick host handle chan text} { global privchan variwannaset foreach channel $privchan {   if {$chan == "$privchan"} {   loadVars vars.tcl   set variwannaset "$text"   putquick "NOTICE $nick :Variable has been set to: \002$variwannaset\002"   saveVars vars.tcl variwannaset    } }}</code></pre></div>The above happens when someone types !setvar &lt; newvariable &gt;<br><br><br>Why is it not saving? <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=4267">collett9</a> — Wed Apr 28, 2004 10:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-04-28T19:16:40-04:00</updated>

		<published>2004-04-28T19:16:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35944#p35944</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35944#p35944"/>
		<title type="html"><![CDATA[if no variable is set]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35944#p35944"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc saveVars {file args} {set f [open $file w]set i 0foreach var $args {upvar 1 $var [incr i]if {[array exists $i]} {puts $f [list array set $var [array get $i]]} elseif {[info exists $i]} {puts $f [list set $var [set $i]]}}close $f}proc loadVars file {uplevel 1 [list source $file]}</code></pre></div>usage:<br>saveVars &lt;your.file&gt; &lt;variable name(s)&gt;<br>loadVars &lt;your.file&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Apr 28, 2004 7:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[collett9]]></name></author>
		<updated>2004-04-28T18:53:57-04:00</updated>

		<published>2004-04-28T18:53:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35943#p35943</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35943#p35943"/>
		<title type="html"><![CDATA[if no variable is set]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35943#p35943"><![CDATA[
<blockquote class="uncited"><div>to safe it permanently you have to write the var into a file and parse it every time you rehash/restart</div></blockquote>how would I do that?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4267">collett9</a> — Wed Apr 28, 2004 6:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2004-04-28T01:42:50-04:00</updated>

		<published>2004-04-28T01:42:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35901#p35901</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35901#p35901"/>
		<title type="html"><![CDATA[if no variable is set]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35901#p35901"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># if myvar doesnt exist -&gt; do somethingif {![info exists myvar]} { .... }# if myvar is empty -&gt; do somethingif {$myvar == ""} { ... }</code></pre></div>to safe it permanently you have to write the var into a file and parse it every time you rehash/restart<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Wed Apr 28, 2004 1:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[collett9]]></name></author>
		<updated>2004-04-28T00:47:46-04:00</updated>

		<published>2004-04-28T00:47:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35900#p35900</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35900#p35900"/>
		<title type="html"><![CDATA[if no variable is set]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35900#p35900"><![CDATA[
I have a script that sets a variable on command<br><br>i.e.<br><br>-set var1 hello<br><br>so that when someone says<br><br>!greet<br><br>the bot says "hello"<br><br>the reason I don't set one in my seperate .tcl file that holds all of the variables is because everytime it restarts it resets it to the default variable, so I am hoping someone can help me out on one of two solutions<br><br>1- if the variable is blank "" on startup, it returns "not set up"<br><br>2- how to save the variable once it is set so that it stays that way through rehashing and restarting<br><br>thanks in advanced<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4267">collett9</a> — Wed Apr 28, 2004 12:47 am</p><hr />
]]></content>
	</entry>
	</feed>
