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

	<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-09-04T03:10:15-04:00</updated>

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

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-04T03:10:15-04:00</updated>

		<published>2003-09-04T03:10:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26446#p26446</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26446#p26446"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26446#p26446"><![CDATA[
<blockquote class="uncited"><div>Well, I'm still "confused" how I should "skip" the other files and see if only a .sub file is there.. I've tryed different alternatives but with no notable success. Any sugestions? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote>You should 'break' out of the loop when a match is found, or set the negative value outside the loop and only change the value when/if a match is found.<br><br>What's wrong with the code I suggested? It won't even need a loop.<br><br>Here's a even less readable one-liner for you ;P<div class="codebox"><p>Code: </p><pre><code>set subtitles [expr {[llength [glob -nocomplain -types f -dir [file join $::db(path) $film] *.sub]]?"Yes":"No"}]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Sep 04, 2003 3:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-04T03:00:55-04:00</updated>

		<published>2003-09-04T03:00:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26444#p26444</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26444#p26444"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26444#p26444"><![CDATA[
Well, I'm still "confused" how I should "skip" the other files and see if only a .sub file is there.. I've tryed different alternatives but with no notable success. Any sugestions? <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=187">caesar</a> — Thu Sep 04, 2003 3:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-03T13:00:47-04:00</updated>

		<published>2003-09-03T13:00:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26342#p26342</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26342#p26342"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26342#p26342"><![CDATA[
Umm.. yes, that makes sence now. Forgot that I was in a loop thing and yes, in some cases there are more than 1 file so happens exactly like you've said. Thanks for pointing that out ppslim.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Sep 03, 2003 1:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-03T12:59:27-04:00</updated>

		<published>2003-09-03T12:59:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26341#p26341</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26341#p26341"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26341#p26341"><![CDATA[
<blockquote class="uncited"><div>caesar, your code proably is working correctly, however, you are forgetting your code is in a loop.<br><br>For every loop of your code, you are setting a value to "No". Thus, once you set the value to "Yes" and there are more files, the it returns to "No"</div></blockquote>Damn, you're right. I thought I saw a 'break' in there (would make sense <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">), but using -dir to specify the dir will prevent matching problems and -nocomplain is "cleaner" that catching the glob <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=2878">user</a> — Wed Sep 03, 2003 12:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-09-03T12:54:04-04:00</updated>

		<published>2003-09-03T12:54:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26338#p26338</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26338#p26338"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26338#p26338"><![CDATA[
caesar, your code proably is working correctly, however, you are forgetting your code is in a loop.<br><br>For every loop of your code, you are setting a value to "No". Thus, once you set the value to "Yes" and there are more files, the it returns to "No"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Sep 03, 2003 12:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-03T08:25:01-04:00</updated>

		<published>2003-09-03T08:25:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26321#p26321</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26321#p26321"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26321#p26321"><![CDATA[
<blockquote class="uncited"><div>the 2nd works fine with ls too and the sources with utimers work fine (everything gets loaded)</div></blockquote>I still think using the built in command to list files would be better.<br><br>The reason the variables "disappear" is because you source the files from within the proc and because of that, their code is executed in the scope of the proc (so the variables are deleted when the proc returns)<br><br>Use 'uplevel #0 [list source $z]' to get it executed in the global namespace (like the timers do)<br><div class="codebox"><p>Code: </p><pre><code>proc loadall {pattern} {  foreach f [glob -nocomplain -types f -dir scripts $pattern] {    uplevel #0 [list source $f]  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Sep 03, 2003 8:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2003-09-03T07:48:34-04:00</updated>

		<published>2003-09-03T07:48:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26320#p26320</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26320#p26320"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26320#p26320"><![CDATA[
the first i get <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>the 2nd works fine with ls too and the sources with utimers work fine (everything gets loaded)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Wed Sep 03, 2003 7:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-03T07:29:26-04:00</updated>

		<published>2003-09-03T07:29:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26319#p26319</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26319#p26319"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26319#p26319"><![CDATA[
<blockquote class="uncited"><div>also had some wired error the last days...</div></blockquote>That's not weird at all... You use list commands on strings and get what you deserve  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br>Use 'string trim' to get rid of the spaces.<br><br>Use 'glob' to list files (there's probably errors in the files sourced by the timers too, but they happen in separate calls, so it wont prevent the rest from loading)<br><br>If you don't get what I mean, I'll come back later and clean up my post..I'm in a bit of a hurry right now...bbl<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Sep 03, 2003 7:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2003-09-03T07:16:41-04:00</updated>

		<published>2003-09-03T07:16:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26318#p26318</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26318#p26318"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26318#p26318"><![CDATA[
also had some wired error the last days..<div class="codebox"><p>Code: </p><pre><code>set in [open $file r]while {![eof $in]} {   set line [gets $in]  set line [lindex $line 0 end] #this is cos every line starts with 2 space chars.....</code></pre></div>a line in the file started this way:<blockquote class="uncited"><div>  "Text": sometext</div></blockquote>it worked with each line, but not with that one (error : list element in quotes followed by ":" instead of space)<br>i fixed it with a "string range" from 3 to end<br><br>or:<div class="codebox"><p>Code: </p><pre><code>proc loadall { string } {  set files [exec ls scripts/]  foreach z [split $files \n] {     if {[string match "$string" $z]} {      utimer 2 "source scripts/$z"              # &lt;- 1rst way, works      source scripts/$z                         # &lt;- 2nd way, doesnt work}}}</code></pre></div>both return the "file.tcl been loaded" thats on the bottom of each file, but with the 2nd way the vars that have been set at the top of the files arent set, the 1rst way sets them....<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Wed Sep 03, 2003 7:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-03T06:44:31-04:00</updated>

		<published>2003-09-03T06:44:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26317#p26317</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26317#p26317"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26317#p26317"><![CDATA[
It dose seem to be working fine now. Thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Sep 03, 2003 6:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-03T06:34:52-04:00</updated>

		<published>2003-09-03T06:34:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26316#p26316</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26316#p26316"/>
		<title type="html"><![CDATA[Re: weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26316#p26316"><![CDATA[
Try something like this:<div class="codebox"><p>Code: </p><pre><code>if {[llength [glob -nocomplain -types f -dir [file join $::db(path) $film] *.sub]]} {has subs} {dont}</code></pre></div>btw: I think the reason you got different results might have to do with glob matching chars in the mask you used (eg. "[" in dir names)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Sep 03, 2003 6:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-03T06:30:30-04:00</updated>

		<published>2003-09-03T06:30:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26314#p26314</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26314#p26314"/>
		<title type="html"><![CDATA[weird]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26314#p26314"><![CDATA[
Using the folowing code:<div class="codebox"><p>Code: </p><pre><code>catch { glob -type f $::db(path)/$film/* } filesforeach bla $files { set subtitle "No"if {[string match "*.sub*" $bla]} { set subtitle "Yes" }}</code></pre></div>where the $bla variable looks like:<br>"/home/irc/raid/upload/movies/2 Fast 2 Furious/2 Fast 2 Furious.sub" sometimes is working, sometimes it dosen't.. When I do a manual test like .tcl set bla "/home/irc/raid/upload/movies/2 Fast 2 Furious/2 Fast 2 Furious.sub" ; if {[string match "*.sub*" $bla]} { putlog "yes" } it's working all the time but when I put it to do the test with if {[string match "*.sub*" $bla]} { set subtitle "Yes" } sometimes it fails.. Any sugestions how to *fix* this?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Sep 03, 2003 6:30 am</p><hr />
]]></content>
	</entry>
	</feed>
