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

	<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>2002-01-21T05:40:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-01-21T05:40:00-04:00</updated>

		<published>2002-01-21T05:40:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3927#p3927</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3927#p3927"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3927#p3927"><![CDATA[
First of all, why didn't you post this under "Tcl &amp; Programming Forum" since this is a Tcl programming question?<br><br>Your script seems overly complicated. Instead of storing everything in one array, have config data in an array, and the release data in a list. Then you can cycle through the releases using a simple "foreach" statement, and search for releases using "lsearch".<br><br>Or, instead of indexing the entries with a number, why don't you use something more descriptive, like the game's name, or an abbreviation for it? Then you won't have to do that loop to shift the higher entries down when you delete.<br><br>You shouldn't need loops to read/write your file, either.<br><br>To save your release data:<br>puts $fp [join [array get releases] "n"]<br><br>To read your release data:<br>array set releases [split [read -nonewline $fp] "n"]<br><br>(This assumes there is no newline in the release data.. you could use another character like 01 if you want to use newlines. Also, if you make it a list instead of an array, you don't need the "array get" and "array set" parts.)<br><br>Also, did you screw up the copy/paste or something? You have a bunch of repeated code.<br><br>You seem to have pub_released already, but it just prints out all the releases? Do you want to add a search capability to it? If so, look up "string match" or "regexp" and you'll see what to do.<br><br>Also, about your first comment, if you can't find anyone to help you, why don't you go read the Tcl manual yourself? All the commands are explained at <a href="http://tcl.activestate.com" class="postlink">http://tcl.activestate.com</a> and <a href="http://dev.scriptics.com" class="postlink">http://dev.scriptics.com</a><br><br>Just a general note, you might find Tcl programming easier if you use normal indentation. It's certainly easier to read and debug.<br><br>Your code:<div class="codebox"><p>Code: </p><pre><code>proc load_released {} {global released  if {[file exists $released(datafile)]} {putlog "Loading Released data from $released(datafile)"                                 set in [open $released(datafile) r]for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {set released($rloop) [gets $in]}                                 close $in                                          }}</code></pre></div>Normal code:<div class="codebox"><p>Code: </p><pre><code>proc load_released {} {  global released  if {[file exists $released(datafile)]} {    putlog "Loading Released data from $released(datafile)"    set in [open $released(datafile) r]    for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {      set released($rloop) [gets $in]    }    close $in  }}</code></pre></div>See isn't that more sane? Hehe, seriously I don't even understand how you choose where to put your closing braces, they're totally random.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Mon Jan 21, 2002 5:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-01-21T02:45:00-04:00</updated>

		<published>2002-01-21T02:45:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3924#p3924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3924#p3924"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3924#p3924"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub $released(killaccess) [cmdchar]killrelease pub_killreleaseproc pub_killrelease {nick uhost hand channel rest} { global released if {($rest &lt; 0) || ($rest &gt; $released(max))} {putserv "NOTICE $nick :$rest is an invalid entry. Must be between 1 and $released(max)"                                               return 0} if {$released(1) == ""} {putserv "NOTICE $nick :There are no release notes in the database."                          return 0}for {set rloop $rest} {$rloop &lt; $released(max)} {incr rloop} {  set rloop1 [expr $rloop + 1]  set released($rloop) $released($rloop1)                               } set released($released(max)) "" putserv "NOTICE $nick :#$rest has been deleted." save_released}bind pub $released(entryaccess) [cmdchar]newrelease pub_newreleaseproc pub_newrelease {nick uhost hand chan rest} { global released if {$rest == ""} {putserv "NOTICE $nick :Calling Syntax: [cmdchar]newrelease Some text string"                   return 0}for {set rloop $released(max)} {$rloop &gt; 1} {incr rloop -1} {  set rloop1 [expr $rloop - 1]  set released($rloop) $released($rloop1)                                                         } set released(1) "$rest" putserv "NOTICE $nick :Added entry for as $rest" save_released}proc save_released {} {global released putlog "Saving Released $released(ver) Data" set out [open $released(datafile) w]for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {puts $out $released($rloop)} close $out}proc load_released {} {global released  if {[file exists $released(datafile)]} {putlog "Loading Released data from $released(datafile)"                                 set in [open $released(datafile) r]for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {set released($rloop) [gets $in]}                                 close $in                                          }}load_releasedproc set_control {nick chan outmsg} { regsub -all {$nick} $outmsg $nick outmsg regsub -all {$chan} $outmsg $chan outmsg regsub -all {[1code]bind pub $released(killaccess) [cmdchar]killrelease pub_killreleaseproc pub_killrelease {nick uhost hand channel rest} { global released if {($rest &lt; 0) || ($rest &gt; $released(max))} {putserv "NOTICE $nick :$rest is an invalid entry. Must be between 1 and $released(max)"                                               return 0} if {$released(1) == ""} {putserv "NOTICE $nick :There are no release notes in the database."                          return 0}for {set rloop $rest} {$rloop &lt; $released(max)} {incr rloop} {  set rloop1 [expr $rloop + 1]  set released($rloop) $released($rloop1)                               } set released($released(max)) "" putserv "NOTICE $nick :#$rest has been deleted." save_released}bind pub $released(entryaccess) [cmdchar]newrelease pub_newreleaseproc pub_newrelease {nick uhost hand chan rest} { global released if {$rest == ""} {putserv "NOTICE $nick :Calling Syntax: [cmdchar]newrelease Some text string"                   return 0}for {set rloop $released(max)} {$rloop &gt; 1} {incr rloop -1} {  set rloop1 [expr $rloop - 1]  set released($rloop) $released($rloop1)                                                         } set released(1) "$rest" putserv "NOTICE $nick :Added entry for as $rest" save_released}proc save_released {} {global released putlog "Saving Released $released(ver) Data" set out [open $released(datafile) w]for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {puts $out $released($rloop)} close $out}proc load_released {} {global released  if {[file exists $released(datafile)]} {putlog "Loading Released data from $released(datafile)"                                 set in [open $released(datafile) r]for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {set released($rloop) [gets $in]}                                 close $in                                          }}load_releasedproc set_control {nick chan outmsg} { regsub -all {$nick} $outmsg $nick outmsg regsub -all {$chan} $outmsg $chan outmsg regsub -all {01} $outmsg 01 outmsg regsub -all {02} $outmsg 02 outmsg regsub -all {26} $outmsg 26 outmsg return "$outmsg"}putlog "XboxGameInfo $released(ver) by `BaGGy` loaded."return "XboxGameInfo $released(ver) by `BaGGy` loaded."</code></pre></div>&lt;font size=-1&gt;[ This Message was edited by: BaGGy on 2002-01-20 23:46 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Mon Jan 21, 2002 2:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-01-21T02:44:00-04:00</updated>

		<published>2002-01-21T02:44:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3923#p3923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3923#p3923"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3923#p3923"><![CDATA[
-=-=-=-=-=-=-=-=-=-=-=-=-=-<br>Here is the source so far:<br>-=-=-=-=-=-=-=-=-=-=-=-=-=-<div class="codebox"><p>Code: </p><pre><code># Location of the file to store data in.set released(datafile) "xgame.dat"############################################################################## Set this to how many records you want it to keep track of.set released(max) 10000############################################################################## Access flag needed to add an entryset released(entryaccess) "m"############################################################################## Access flag needed to remove and entryset released(killaccess) "m"#############################################################################set released(noentries) {Currently, no entries have been added.}#############################################################################set released(header) { {Test Header}                     }set released(footer) { {Test Footer}                      }set released(ver) "v1.0.0"#############################################################################set cmdchar_ "."proc cmdchar { } { global cmdchar_ return $cmdchar_}for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {set released($rloop) ""}bind pub - [cmdchar]released pub_releasedproc pub_released {nick uhost hand channel rest} { global released set rnum 0 #foreach oline {putserv "NOTICE $nick :[set_control $nick $channel $oline]"}for {set rloop 1} {$rloop &lt; [expr $released(max) + 1]} {incr rloop} {  if {$released($rloop) != ""} {set r_time [ctime [lindex $released($rloop) 0]]                                set r_desc [lrange $released($rloop) 0 end]                                putserv "PRIVMSG $channel : [format "%2s" $rloop]: $r_desc"                                incr rnum                               }                      } if {$rnum == 0} {putserv "NOTICE $nick :[set_control $nick $channel $released(noentries)]"} #foreach oline {putserv "NOTICE $nick :[set_control $nick $channel $oline]"}}</code></pre></div>&lt;font size=-1&gt;[ This Message was edited by: BaGGy on 2002-01-20 23:44 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Mon Jan 21, 2002 2:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-01-21T02:43:00-04:00</updated>

		<published>2002-01-21T02:43:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3922#p3922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3922#p3922"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3922#p3922"><![CDATA[
Ok what i am trying to do is make a script that will search a flatfile and give output.<br><br>What: I am making a script that will make it easier for users to check the release dates of certain xbox games just by typing the trigger and gamename. I also want master users to be able to add/remove games to the list.<br><br>How: How it will work is like this: <div class="codebox"><p>Code: </p><pre><code>("&gt;" == user output &amp;&amp; "&lt;" == bot input &amp;&amp; "&gt;&gt;" == bot output)&gt; .released DoA3&lt;&lt; Search for DoA3....&lt;&lt; DoA3 found in game number 43 "43#Dead or Alive 3#Out#2#Action#No#Techmo#Team Ninja#DoA3#DoA 3#doa"&gt;&gt; (43) [b]Game Name:[/b] Dead or Alive 3  [b]Release Date:[/b] Out  [b]Genre:[/b] Action  [b]Multiplayer Support:[/b] No [b]Publisher:[/b] Techmo  [b]Developer:[/b] Team Ninja </code></pre></div>&lt;font size=-1&gt;[ This Message was edited by: BaGGy on 2002-01-20 23:44 ]&lt;/font&gt;<br><br>&lt;font size=-1&gt;[ This Message was edited by: BaGGy on 2002-01-20 23:46 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Mon Jan 21, 2002 2:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-01-21T02:42:00-04:00</updated>

		<published>2002-01-21T02:42:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3921#p3921</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3921#p3921"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3921#p3921"><![CDATA[
<p>Statistics: Posted by Guest — Mon Jan 21, 2002 2:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-01-21T01:45:00-04:00</updated>

		<published>2002-01-21T01:45:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3920#p3920</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3920#p3920"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3920#p3920"><![CDATA[
maybe if you said what your one thing was we'd be able to help<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Mon Jan 21, 2002 1:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-01-21T00:51:00-04:00</updated>

		<published>2002-01-21T00:51:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=3918#p3918</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=3918#p3918"/>
		<title type="html"><![CDATA[TCL really sucks..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=3918#p3918"><![CDATA[
TCL really sucks because I cant find anyone who can help me program for it, I am having problems with one thing and I need help. I have searched DALnet, Undernet, and IRCnet for help and no one was a TCL programmer or they are all bots or even away.<br><br>I really could use some help.<br><br>BTW add PHP coding support hehe i cant stand tcl, i am sorry but i cant!<p>Statistics: Posted by Guest — Mon Jan 21, 2002 12:51 am</p><hr />
]]></content>
	</entry>
	</feed>
