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

	<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-01-08T08:05:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-08T08:05:17-04:00</updated>

		<published>2005-01-08T08:05:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45192#p45192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45192#p45192"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45192#p45192"><![CDATA[
thx alot,<br><br>going to put an addlog into that oo, for your credit because i'm going to package that with the commands.tcl that's spread for dutch users<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Sat Jan 08, 2005 8:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T19:20:38-04:00</updated>

		<published>2005-01-07T19:20:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45180#p45180</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45180#p45180"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45180#p45180"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set yourFileName "some.file"proc saveArray {array file {mode w}} {upvar 1 $array Arrayset data [array get Array]set f [open $file $mode]puts $f $dataclose $f}proc loadArray {array file} {if {![file readable $file]} returnupvar 1 $array Arrayarray set Array {}set f [open $file]set data [read -nonewline $f]close $farray set Array $data}proc yourSave args { global topicinfosaveArray topicinfo $::yourFileName;# notice those :'s} loadArray topicinfo $yourFileName</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 7:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T18:28:43-04:00</updated>

		<published>2005-01-07T18:28:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45177#p45177</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45177#p45177"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45177#p45177"><![CDATA[
ack,<br><br>seems I can't follow anymore now.<br><br>i've been trying to change those to my own vars but every time i try to load the bot it gives a tcl error about the last "loadarray" line that it can't read $mychosenvar because it isn't set or smething..<br><br>although i also renamed the set mychosenvar , and then the file it should be, <br><br>something isn't really working, (and i'd like the debugging to be included still because that way i can be rememberd to actually touch the file in the root dir of eggdrop, so now I have something like this:<br><div class="codebox"><p>Code: </p><pre><code>#bind evnt - save PubVarSavebind evnt - prerehash PubVarSaveproc PubVarSave args {   global topicinfo   set file "botname.public"   if {[info exists topicinfo]} {      if {[file writable $file]} {         saveArray topicinfo $file         putlog "Saving extra variables..."      } else {         putlog "can't write $file, did you touch it in eggdrop root ?"      }   } else {      putlog "no array. Have you loaded commands.tcl ? :/"   }}proc saveArray {array file {mode w}} {   if {![file writable $file]} return   upvar 1 $array Array   set data [array get Array]   set f [open $file $mode]   puts $f $data   close $f}proc loadArray {array file} {   if {![file readable $file]} return   upvar 1 $array Array   array set Array {}   set f [open $file]   set data [read -nonewline $f]   close $f   array set Array $data}# edit filename the same as your "set" file aboveloadArray topicinfo botname.public</code></pre></div>Well this code works , but i have that problem with the changing of the $file variable ..<br><br>when i change it to something and i also change LoadArray topicinfo $chanvars or something , the bot gives an error ...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 6:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T17:09:34-04:00</updated>

		<published>2005-01-07T17:09:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45172#p45172</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45172#p45172"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45172#p45172"><![CDATA[
the variable can be called what ever you like, but take the code from my previous post and replace the same old proc (those checks we did for debugging are not needed any more)<div class="codebox"><p>Code: </p><pre><code>set yourFileVar "some.file"proc yourSave args { global topicinfosaveArray topicinfo $::yourFileVar} loadArray topicinfo $yourFileVar</code></pre></div>btw: did you miss the edit button or something? (that self-quote) <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=2878">user</a> — Fri Jan 07, 2005 5:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T16:42:44-04:00</updated>

		<published>2005-01-07T16:42:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45170#p45170</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45170#p45170"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45170#p45170"><![CDATA[
<blockquote class="uncited"><div>wow,<br><br>when i created the file in the eggdrop root it started saving data <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.. thats cool<br><br>now I actually hope it'll also load this data on startup,<br><br>i created a sepparate tcl for this procedure you gave me...<br><br>UPDATE:<br>ok now it saves and loads all, thanks for your patience and help, i just need to do something and that is, to unify the way you set the file and you load the userfile on that last line <br><br>so i have the script you provided in a sepparate tcl:<br><div class="codebox"><p>Code: </p><pre><code># saving your "topicinfo" array to "your.file"bind evnt - save yourSavebind evnt - prerehash yourSaveproc yourSave args {   global topicinfo   set file "mybot.public"   if {[info exists topicinfo]} {      if {[file writable $file]} {         saveArray topicinfo $file         putlog "Saving extra variables..."      } else {         putlog "can't write $file"      }   } else {      putlog "no array? :/"   }}proc saveArray {array file {mode w}} {   if {![file writable $file]} return   upvar 1 $array Array   set data [array get Array]   set f [open $file $mode]   puts $f $data   close $f}proc loadArray {array file} {   if {![file readable $file]} return   upvar 1 $array Array   array set Array {}   set f [open $file]   set data [read -nonewline $f]   close $f   array set Array $data}loadArray topicinfo mybot.public</code></pre></div>Well,  shouldnt that last file now be:<div class="codebox"><p>Code: </p><pre><code>loadArray topicinfo $file</code></pre></div></div></blockquote>as a sidenote, could i also change set file to set variablefile and then use $variablefile (or something like that) just to really make sure that i am not obstructing any other vars or so<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 4:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T16:23:43-04:00</updated>

		<published>2005-01-07T16:23:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45169#p45169</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45169#p45169"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45169#p45169"><![CDATA[
wow,<br><br>when i created the file in the eggdrop root it started saving data <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">.. thats cool<br><br>now I actually hope it'll also load this data on startup,<br><br>i created a sepparate tcl for this procedure you gave me...<br><br>UPDATE:<br>ok now it saves and loads all, thanks for your patience and help, i just need to do something and that is, to unify the way you set the file and you load the userfile on that last line <br><br>so i have the script you provided in a sepparate tcl:<br><div class="codebox"><p>Code: </p><pre><code># saving your "topicinfo" array to "your.file"bind evnt - save yourSavebind evnt - prerehash yourSaveproc yourSave args {   global topicinfo   set file "mybot.public"   if {[info exists topicinfo]} {      if {[file writable $file]} {         saveArray topicinfo $file         putlog "Saving extra variables..."      } else {         putlog "can't write $file"      }   } else {      putlog "no array? :/"   }}proc saveArray {array file {mode w}} {   if {![file writable $file]} return   upvar 1 $array Array   set data [array get Array]   set f [open $file $mode]   puts $f $data   close $f}proc loadArray {array file} {   if {![file readable $file]} return   upvar 1 $array Array   array set Array {}   set f [open $file]   set data [read -nonewline $f]   close $f   array set Array $data}loadArray topicinfo mybot.public</code></pre></div>Well,  shouldnt that last file now be:<div class="codebox"><p>Code: </p><pre><code>loadArray topicinfo $file</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 4:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T16:15:36-04:00</updated>

		<published>2005-01-07T16:15:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45167#p45167</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45167#p45167"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45167#p45167"><![CDATA[
Does the file exist? Is your working directory changed to something weird? (putlog [pwd]) Try creating the file if it doesn't exist and see if that helps.<br><br>EDIT: doh...it seems like file writable expects the file to exist...that's stupid <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><div class="codebox"><p>Code: </p><pre><code>proc saveArray {array file {mode w}} {if {([file exists $file]&amp;&amp;![file writable $file])||![file writable [file dir $file]]} returnupvar 1 $array Arrayset data [array get Array]set f [open $file $mode]puts $f $dataclose $f}proc loadArray {array file} {if {![file readable $file]} returnupvar 1 $array Arrayarray set Array {}set f [open $file]set data [read -nonewline $f]close $farray set Array $data}# saving your "topicinfo" array to "your.file"bind evnt - save yourSavebind evnt - prerehash yourSaveproc yourSave args {global topicinfosaveArray topicinfo your.file}loadArray topicinfo your.file</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 4:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T16:15:43-04:00</updated>

		<published>2005-01-07T16:12:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45164#p45164</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45164#p45164"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45164#p45164"><![CDATA[
yep,<br><br>now it says "can't write file"..<br><br>i changed that your.file into botname.public so i knew what i had to look for ,<br><br>but now with this new proc it seems taht thers a problem writing the file, weird that all other files are writable...<br><br>i even set the scripts dir to 777 and that doesnt work <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 4:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T16:05:41-04:00</updated>

		<published>2005-01-07T16:05:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45163#p45163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45163#p45163"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45163#p45163"><![CDATA[
<blockquote class="uncited"><div>i see the entry when i enter the "save" command, but no file is being written on the disk</div></blockquote>The "topicinfo saved?" message? Did you remember to change the file name in the proc? Replace the proc once more...<div class="codebox"><p>Code: </p><pre><code>proc yourSave args { global topicinfoset file "your.file"if {[info exists topicinfo]} {if {[file writable $file]} {saveArray topicinfo $fileputlog "topicinfo saved to $file"} else {putlog "can't write $file"}} else {putlog "no array? :/"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 4:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T15:43:49-04:00</updated>

		<published>2005-01-07T15:43:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45159#p45159</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45159#p45159"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45159#p45159"><![CDATA[
well,<br><br>i see the entry when i enter the "save" command, but no file is being written on the disk<br><br>I have write access for the linux user to all disks, so i can't see what is going wrong realy.<br><br>and the fact that it doesnt show the other message to indicate that theres no userinfo vars,  must mean that it actually should work ?<br><br>i know that this script also saves some extra info to the user file..., wonder why this doesn't work though<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 3:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T15:34:06-04:00</updated>

		<published>2005-01-07T15:34:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45156#p45156</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45156#p45156"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45156#p45156"><![CDATA[
Are you sure the script is loaded? Replace the yourSave proc with this one and see what happens...<div class="codebox"><p>Code: </p><pre><code>proc yourSave args { global topicinfoif {[info exists topicinfo]} {saveArray topicinfo your.fileputlog "topicinfo saved?"} else {putlog "no array? :/"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 3:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T15:14:26-04:00</updated>

		<published>2005-01-07T15:14:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45153#p45153</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45153#p45153"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45153#p45153"><![CDATA[
theres no namespace mentioned, <br><br>when i did save it didn't create anything, not even an empty file...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 3:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T15:01:33-04:00</updated>

		<published>2005-01-07T15:01:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45151#p45151</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45151#p45151"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45151#p45151"><![CDATA[
is the word "namespace" mentioned anywhere in the script? what happened when you did .save? did it create an empty file? (posting entire scripts is fine as long as they're not too big...how big is too big? I don't know <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=2878">user</a> — Fri Jan 07, 2005 3:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CosmicD]]></name></author>
		<updated>2005-01-07T15:04:03-04:00</updated>

		<published>2005-01-07T14:54:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45150#p45150</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45150#p45150"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45150#p45150"><![CDATA[
lol.. namespace ? dont know enough to know what it is,<br><br>if its not too much could i send that script over or is it allowed to post an entire script here so it can be inspected in its whole...<br><br>EDIT:<br><br>i think i might understand, the settings are configurable for each channel sepparately, does that have something to do with it ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5772">CosmicD</a> — Fri Jan 07, 2005 2:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2005-01-07T14:49:01-04:00</updated>

		<published>2005-01-07T14:49:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=45149#p45149</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=45149#p45149"/>
		<title type="html"><![CDATA[botscript doesn't save some variables]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=45149#p45149"><![CDATA[
you mean "topicinfo(vchan$channel)"? that's an element in the array, so it should be saved...if topicinfo is a global array. Is your script using a different namespace maybe?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 07, 2005 2:49 pm</p><hr />
]]></content>
	</entry>
	</feed>
