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

	<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>2003-04-11T06:52:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-11T06:52:17-04:00</updated>

		<published>2003-04-11T06:52:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18903#p18903</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18903#p18903"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18903#p18903"><![CDATA[
Yup, it keeps the file stored after restart now <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>All i can say is a big thanks to you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Apr 11, 2003 6:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-11T05:04:03-04:00</updated>

		<published>2003-04-11T05:04:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18901#p18901</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18901#p18901"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18901#p18901"><![CDATA[
Damn, that toook longer than I thought.<br><br>Download again, I now have it working, and I don't know what I did to fix it though <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=2">ppslim</a> — Fri Apr 11, 2003 5:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-11T04:41:34-04:00</updated>

		<published>2003-04-11T04:41:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18900#p18900</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18900#p18900"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18900#p18900"><![CDATA[
OK, the error you are getting is a fault on your part. As I have noted, the -init setting is to initilise the variable.<br><br>This is done in 1 of three ways.<br><br>1: If the variable allready exists, do not change the value, leave it as it is. This is for a .rehash.<br><br>2: If not, then check to see if it is in the file. If it is, set it to the value in the file.<br><br>3: If not in the file, use the default value given and save this to the file.<br><br>The default should only ever be used on the very first attempt, or the line has been deleted from the file.<br><br>The error given to you, says it is unable to find a file called default. Well, it's pretty damned obvious what the error means. You could do with a "file exists" check in the pub:picoday command.<br><br>You might also want to update my script again, I have made a change. However, I am abotu to go do some testing on it myself, because it is doing my head in.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Apr 11, 2003 4:41 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-10T15:37:25-04:00</updated>

		<published>2003-04-10T15:37:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18884#p18884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18884#p18884"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18884#p18884"><![CDATA[
[20:32:36] &lt;Natsuki-Chan&gt; [20:32] Tcl error [pub:potdinfo]: could not read "default": no such file or directory<br><br>{picoday default} &lt; picoday.db.file<br><br>Updated the file to show what the script is now.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Apr 10, 2003 3:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-10T15:13:04-04:00</updated>

		<published>2003-04-10T15:13:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18881#p18881</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18881#p18881"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18881#p18881"><![CDATA[
I have made one change to the script, you may wish to download it again.<br><br>1: After the bots has started, make a change using the !pic_set command.<br><br>2: Goto the shell, edit the database file, and look at what the contents are.<br><br>3: Issue a .restart<br><br>4: Edit the file again, and see fi the file changes.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Apr 10, 2003 3:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-10T12:13:53-04:00</updated>

		<published>2003-04-10T12:13:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18877#p18877</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18877#p18877"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18877#p18877"><![CDATA[
File was created before i made it. <br><br>Good news is, she is retaining a variable now. But, as the default line did make it, the variable became...<br><blockquote class="uncited"><div>{picoday default}</div></blockquote> <br><br>upon restart<br><br>What i was figuring is if instead of replacing the last line, which the script seems to have done, is to just check what the last line was, and extract the filename from there? As it would create some pseudo form of logging of what pictures have been used as the picture of the day. Will probably do some playing with writing to files tonight, see if i can figure getting info from lines and stuff <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Apr 10, 2003 12:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-10T09:27:44-04:00</updated>

		<published>2003-04-10T09:27:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18862#p18862</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18862#p18862"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18862#p18862"><![CDATA[
First off, you should move the "setsave -init" line further down. Below the "set:save" proc.<br><br>I noticed why there was a missing bracket now. It was when I hadn't cleared up funny and tidying the code. At this time, using "-init" causes this problem.<br><br>Redownload<br><br>Aditionaly, did you create the file as noted?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Apr 10, 2003 9:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-10T08:22:12-04:00</updated>

		<published>2003-04-10T08:22:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18859#p18859</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18859#p18859"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18859#p18859"><![CDATA[
if picoday is set using<br><br>setsave -init picoday default<br><br>I do still have to use the <br><br>setsave picoday [file join $dir(main) $dir(filename)]<br><br>in the proc pub:picoday?<br><br>[edit] <br><br>Re-Read the instructions above, understand where to put it now. Think i need both, but setsave -init outside of a proc <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Changed the download to show the script<br><br>[edit2]<br><br>{picoday filesys/incoming/1044150826579.jpg} is what it records <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> And DOES change when a new image is set.<br><br>only one problem<br><br>At restart, this occurs<br><br>[13:28:24] &lt;Natsuki-Chan&gt; [13:28] Tcl error [pub:pic]: can't read "picoday": no such variable<br><br>Which means the variable has been wiped, and i done it wrong <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=1195">Weirdo</a> — Thu Apr 10, 2003 8:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-10T08:17:27-04:00</updated>

		<published>2003-04-10T08:17:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18856#p18856</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18856#p18856"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18856#p18856"><![CDATA[
First off, I have changed the script again. It fixes the missing bracket, and also prevents the error you have shown.<br><br>However, you should also have a "setsave -init" line.<br><br>Without this line, your script will not re-load the previously set value when the bot died.<br><br>It will need to be below the "proc setsave" definition.<br><br>Use<br><div class="codebox"><p>Code: </p><pre><code>setsave -init picoday default</code></pre></div>This will make it reload the value each time.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Apr 10, 2003 8:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-10T07:45:25-04:00</updated>

		<published>2003-04-10T07:45:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18853#p18853</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18853#p18853"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18853#p18853"><![CDATA[
Was missing a close brace, added it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Giving me a Picoday - no such variable error now. Thats the variable i am using for set save. I have uploaded the changed tcl file to the link above <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Apr 10, 2003 7:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-10T07:29:02-04:00</updated>

		<published>2003-04-10T07:29:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18849#p18849</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18849#p18849"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18849#p18849"><![CDATA[
Re-download the file form the link. I remember thinking about that when making it, but thought it wasn't need (WRONG) <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>It will only create one line for each variable.<br><br>This prevents the file from becoming bloated.<br><br>It should never cause a error, but when file doesn't exist, all data is lost. So you will also need to create the file first. Quickest way, is to use "touch file.name" on the shell.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Apr 10, 2003 7:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-10T07:19:38-04:00</updated>

		<published>2003-04-10T07:19:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18847#p18847</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18847#p18847"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18847#p18847"><![CDATA[
W...o....w<br><br>Ill give it a go. <br><br>Slight Question on when it adds to the file. Does it add a new line for each file that is set? <br><br><a href="http://sucess.faereal.net/sebstuff/picoday.tcl" class="postlink">http://sucess.faereal.net/sebstuff/picoday.tcl</a><br><br>thats the file as it is at the moment. Currently getting a variable error on the !set_pic command. <br><blockquote class="uncited"><div>[12:16:36] &lt;Natsuki-Chan&gt; [12:16] Tcl error [pub:picoday]: can't read "mode": no such variable</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Apr 10, 2003 7:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-10T06:02:26-04:00</updated>

		<published>2003-04-10T06:02:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18838#p18838</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18838#p18838"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18838#p18838"><![CDATA[
I have been nice, and produced a nice little script for you. It is a replacment for the "set" command, which you should only use of stored variables.<br><div class="codebox"><p>Code: </p><pre><code>set setfile "/path.to.file/containing/vars"proc setsave {name value {type {}}} {  if {$type != ""} {    set mode $name    set name $value    set value $type  }  global $name  switch -- [string tolower $mode] {    {-init} {      if {[info exists $name]} { return $[subst $name] }      if {![catch {set int [set:read $name]}]} { set $name $int; return $int }      set $name $value; return [set:save $name $value]    }    default {      return [set:save $name $value]    }  }}proc set:read {name} {  global setfile  if {![file exists $setfile]} { return "" }  set fp [open $setfile r]  set list [read nonewline $fp]  close $fp  if {[set idx [lsearch -glob $list "$name *"]] == -1} { error "Not set here, do your thing" }  return [lindex [lindex $list $idx] 1]}proc set:save {name value} {  global setfile  if {![file exists $setfile]} { return "" }  set fp [open $setfile r]  set list [read -nonewline $fp]  close $fp  if {[set idx [lsearch -glob $list "$name *"]] != -1} {    set list [lreplace $list $idx $idx [list $name $value]]  } else {    lappend list [list $name $value]  }  set fp [open $setfile w]  puts $fp $list  close $fp  return $value}</code></pre></div>Also download at <a href="http://www.ppslim.ukshells.co.uk/prov/egghelp/setwrapper.tcl" class="postlink">http://www.ppslim.ukshells.co.uk/prov/e ... rapper.tcl</a><br><br>This has two uses, it will prevent set over-writting when you rehash the bot, so long as you use it correctly.<br><br>Use it like follows<br><br>When defining the default settings for a script, you normaly use the set command near the top of the file, but not in a procedure (proc). Replace<div class="codebox"><p>Code: </p><pre><code>set defaultscriptsetting "value"</code></pre></div>to<div class="codebox"><p>Code: </p><pre><code>setsave -init defaultscriptsetting "value"</code></pre></div>This does one of three things.<br><br>1: On a rehash, it will check to see if the setting exists, if it does, leave it as it is, and do not replace its current value with "value".<br><br>2: It will try and read the setting from a file (on start or .restart). If the setting is in the file, it uses this setting, instead of "value"<br><br>3: If not in memory, or in the file, it saves "value" to the file, and uses "value" as the setting.<br><br>When you create a command in a script, that is designed to changes a setting (EG, you make a public kick script, and you are using a command to change the DEFAULT kick message), instead of making the setting global and chanign the value, use the "setsave" command<br><br>EG, from<div class="codebox"><p>Code: </p><pre><code>setsave -init defaultkick "Goodbye"proc kickchange {nick uh hand chan arg} {  #do some checking  global defaultkick  set defaultkick $arg}</code></pre></div>This will only change it while the setting is in memory<br><br>CHange it too<div class="codebox"><p>Code: </p><pre><code>setsave -init defaultkick "Goodbye"proc kickchange {nick uh hand chan arg} {  #do some checking  setsave defaultkick $arg}</code></pre></div>Note there is no -init in this.<br><br>When there is no -init, it simply saves the new setting to the file.<br><br>This setsave only works on global variables. You then use the variables the way you normaly do.<br><br>These command just take care of the save and read functions.<br><br>Warning: I havn't tested the code in any way. If you have any problems, just ask.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Apr 10, 2003 6:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-04-09T19:00:05-04:00</updated>

		<published>2003-04-09T19:00:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18811#p18811</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18811#p18811"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18811#p18811"><![CDATA[
Right, so definate writing to the first line of a variables file. perhaps could write something that could write new line for each time the script is set and a new pic set as $picoday, then add a line at end of file. Then, when !picoday is ran again, it checks last line of file, resets the variable, perhaps that can be done on reboot of the bot. <br><br>Got any links for file manipulation in this manner. Definately my weakpoint at the moment?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Wed Apr 09, 2003 7:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-04-09T18:33:40-04:00</updated>

		<published>2003-04-09T18:33:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=18810#p18810</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=18810#p18810"/>
		<title type="html"><![CDATA[Wee bit o help needed]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=18810#p18810"><![CDATA[
This would require that you save and restore the data amnualy to some form of database, be it a flatfile (simple write and read file) or full blown mysql DB.<br><br>The bot should survive a .rehash, so long as you don't overwrite the variable in the global context when reading the script.<br><br>EG<div class="codebox"><p>Code: </p><pre><code>set a testproc blah {} {  blah}</code></pre></div>When a rehash takles place, $a will be set to test, even if a change has taken place elsewhere in the script.<br><br>SOmthing like<div class="codebox"><p>Code: </p><pre><code>if {![info exists]} { set a test }</code></pre></div>Will stop rehash from overwritting it.<br><br>A .restart wipes the memory, and is in effect, the same as doing a ".die" and starting the bot from the shell, except the bot doesn't die. No variables survive this.<br><br>".die" means memory is totaly freed, and it doesn't survive.<br><br>and a PC reboot is obvious.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Apr 09, 2003 6:33 pm</p><hr />
]]></content>
	</entry>
	</feed>
