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

	<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>2008-04-29T04:00:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[MrStatic]]></name></author>
		<updated>2008-04-29T04:00:48-04:00</updated>

		<published>2008-04-29T04:00:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82610#p82610</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82610#p82610"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82610#p82610"><![CDATA[
Heh I realize this is an old post but the code still works wonders but I am attempting to add to it and I am having issues. I am looking to delay the output in the foreach loop<br><div class="codebox"><p>Code: </p><pre><code>               foreach line $lines {                  # puthelp will give you about 4 seconds delay between lines                  puthelp "PRIVMSG $chan :$line"               }</code></pre></div>I have searched the forums and I found <a href="http://forum.egghelp.org/viewtopic.php?t=14021&amp;highlight=delay+output" class="postlink">http://forum.egghelp.org/viewtopic.php? ... lay+output</a><br>but I am still having issues making it work, any insights would be helpful as well if there is an easier way to pull this off. I am looking for say 30 seconds between each line or 60 seconds.<br><br>Added<div class="codebox"><p>Code: </p><pre><code>               foreach line $lines {                  # puthelp will give you about 4 seconds delay between lines                  utimer 30 [ putserv "PRIVMSG $chan :$line" ]               }</code></pre></div>Works but does not actually delay by 30 seconds, maybe If I put it in an array and play that out with a timer? I have no idea how to do that tho in tcl<br><br>******<br>Another edit, got it finally<div class="codebox"><p>Code: </p><pre><code>set time 0            if {[catch {get_file "$0 $1"} lines]} {               puthelp "PRIVMSG $chan :$nick: Error: $lines"            } {               foreach line $lines {                  # puthelp will give you about 4 seconds delay between lines                  utimer [incr time 30] [list putserv "PRIVMSG $chan :$line"]               }            }</code></pre></div>Now to try and see if I can pull the first part of the file for a variable like have it say 0 Text then 30 text tp represent time for timers<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9893">MrStatic</a> — Tue Apr 29, 2008 4:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Faraibi]]></name></author>
		<updated>2008-01-19T06:02:16-04:00</updated>

		<published>2008-01-19T06:02:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80202#p80202</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80202#p80202"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80202#p80202"><![CDATA[
and one more thing, if there are a number of files in the subdirectory, the bot only displays the names which come in one line, the bot doesn't display the rest in 2nd line..<br><br>can we have some thing like, the bot displays some number of files in first, and some in 2nd and some in third line.<br><br>so that all the file names can be displayed which are in the sub-directory<br><br>thankyou !<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9378">Faraibi</a> — Sat Jan 19, 2008 6:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Faraibi]]></name></author>
		<updated>2008-01-19T03:44:34-04:00</updated>

		<published>2008-01-19T03:44:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80201#p80201</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80201#p80201"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80201#p80201"><![CDATA[
user thanks a lot<br>it really worked<br>the bot is dumping the files on channel now <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>thank you for this..<br><br><br>one more thing, can i add timer to this ? like if the file is big, having 50..60 lines, the bot displays every next line after some seconds, 10 or more ? so that bot wont flood.<br>10+ seconds for next line<br>is this possible ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9378">Faraibi</a> — Sat Jan 19, 2008 3:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2008-01-19T01:14:16-04:00</updated>

		<published>2008-01-19T01:14:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80200#p80200</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80200#p80200"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80200#p80200"><![CDATA[
There was a stupid regexp bug (missing argument). Try the edited version.<br>If you want the output in the channel, change <div class="codebox"><p>Code: </p><pre><code>puthelp "PRIVMSG $nick :$line"</code></pre></div> to <div class="codebox"><p>Code: </p><pre><code>puthelp "PRIVMSG $chan :$line"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Sat Jan 19, 2008 1:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Faraibi]]></name></author>
		<updated>2008-01-18T14:08:27-04:00</updated>

		<published>2008-01-18T14:08:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80192#p80192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80192#p80192"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80192#p80192"><![CDATA[
<blockquote class="uncited"><div>You need to use "!display sports cricket" to display the contents. The bot can't read your mind thus it won't know what you want unless you tell it what you want.</div></blockquote>That's what i was asking, it is not displaying the file contents (dumping the file in the channel)<br>what it do is:<br><br>&lt;TuN&gt; !display sports cricket<br>&lt;Shugal&gt; TuN: Error: invalid category<br><br>and cricket.txt file is in sports directory, and the bot lists cricket file when i do this "!display sports" it lists cricket file. but when i do this "!display sports cricket" it gives<br><br>"&lt;Shugal&gt; TuN: Error: invalid category"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9378">Faraibi</a> — Fri Jan 18, 2008 2:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2008-01-18T14:01:44-04:00</updated>

		<published>2008-01-18T14:01:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80190#p80190</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80190#p80190"/>
		<title type="html"><![CDATA[Re: thanks user]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80190#p80190"><![CDATA[
<blockquote class="uncited"><div>thanks user and tosser.<br><br>user i tried your tcl. <br>it works fine for listing directory. But it is not dumping the text file.<br><br>&lt;TuN&gt;!display<br>&lt;Shugal&gt; TuN: sports, games<br>&lt;TuN&gt;!display sports<br>&lt;Shugal&gt;TuN: cricket, playingminds<br>&lt;TuN&gt;!display cricket<br>&lt;Shugal&gt; TuN: Error: invalid category<br><br>I made cricket.txt inside sports directory. it displays the name<br>but when i do this !display cricket<br>or !display cricket.txt the result is:<br><br>&lt;Shugal&gt; TuN: Error: invalid category<br><br>(Shugal is my botnick)<br><br>I also did "!display sports cricket" and "!display sports cricket.txt" but it dint work, the same error "&lt;Shugal&gt; TuN: Error: invalid category". So, any idea what is the problem ?</div></blockquote>You need to use "!display sports cricket" to display the contents. The bot can't read your mind thus it won't know what you want unless you tell it what you want.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Fri Jan 18, 2008 2:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rix]]></name></author>
		<updated>2008-01-18T13:28:57-04:00</updated>

		<published>2008-01-18T13:28:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80189#p80189</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80189#p80189"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80189#p80189"><![CDATA[
Is it possible to just list the directory content?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6753">rix</a> — Fri Jan 18, 2008 1:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Faraibi]]></name></author>
		<updated>2008-01-18T12:57:04-04:00</updated>

		<published>2008-01-18T12:57:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80188#p80188</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80188#p80188"/>
		<title type="html"><![CDATA[thanks user]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80188#p80188"><![CDATA[
thanks user and tosser.<br><br>user i tried your tcl. <br>it works fine for listing directory. But it is not dumping the text file.<br><br>&lt;TuN&gt;!display<br>&lt;Shugal&gt; TuN: sports, games<br>&lt;TuN&gt;!display sports<br>&lt;Shugal&gt;TuN: cricket, playingminds<br>&lt;TuN&gt;!display cricket<br>&lt;Shugal&gt; TuN: Error: invalid category<br><br>I made cricket.txt inside sports directory. it displays the name<br>but when i do this !display cricket<br>or !display cricket.txt the result is:<br><br>&lt;Shugal&gt; TuN: Error: invalid category<br><br>(Shugal is my botnick)<br><br>I also did "!display sports cricket" and "!display sports cricket.txt" but it dint work, the same error "&lt;Shugal&gt; TuN: Error: invalid category". So, any idea what is the problem ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9378">Faraibi</a> — Fri Jan 18, 2008 12:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2008-01-19T01:13:17-04:00</updated>

		<published>2008-01-18T07:57:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80185#p80185</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80185#p80185"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80185#p80185"><![CDATA[
<blockquote class="uncited"><div>Take a look at <a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">http://forum.egghelp.org/viewtopic.php?t=6885</a> for basic file operations, then modify one of the scripts you have found to your requirements. Learn the file commands to grab the contents of a dir and display the list of subdirs, and the contents of the file(s) you want to display along with foreach loop for your line-to-line output.</div></blockquote>This is not the scripting help forum. Making this script is not as easy as it sounds and could be dangerous if done by a newbie (directory traversal bugs)<br><br>Here's a mockup (not tested). I packed all the features into a single command (the number of arguments determine what action is performed)<div class="codebox"><p>Code: </p><pre><code>namespace eval ::txthing {bind pub - !display ::txthing::pubcmdvariable basedir "~/"variable fileext ".txt"proc pubcmd {nick uhost hand chan arg} {# scan takes care of two things; stripping whitespace and counting the wordsswitch -- [scan $arg %s%s%s 0 1 2] {-1 - 0 {# 0 args - list dirsif {![llength [set dirs [list_dirs]]]} {puthelp "PRIVMSG $chan :$nick: Configuration error: basedir does not exist or is empty."} {puthelp "PRIVMSG $chan :$nick: [join $dirs ", "]"}}1 {# 1 arg - list files in a dirif {[catch {list_files $0} files]} {puthelp "PRIVMSG $chan :$nick: Error: $files"} {puthelp "PRIVMSG $chan :$nick: [join $files ", "]"}}2 {# 2 args - fetch file contentsif {[catch {get_file "$0 $1"} lines]} {puthelp "PRIVMSG $chan :$nick: Error: $lines"} {foreach line $lines {# puthelp will give you about 4 seconds delay between linesputhelp "PRIVMSG $nick :$line"}}}default {# 3 or more argsputhelp "PRIVMSG $chan :$nick: usage: $::lastbind ?category? ?subcategory?"}}}proc list_dirs {} {variable basedirset list {}foreach dir [glob -nocomplain -type d -dir $basedir *] {lappend list [file tail $dir]}set list}proc list_files dir {variable basedirvariable fileext# no . or / allowed in names (quick hack to prevent directory traversal)if {![regexp {^[^\./]+$} $dir]} {error "invalid category"}set dir [file join $basedir $dir]if {![file isdir $dir]} {error "invalid category"}set list {}foreach file [glob -nocomplain -type f -dir $dir *$fileext] {lappend list [file root [file tail $file]]}set list}proc get_file arg {variable basedirvariable fileext# no . or / allowed in names (quick hack to prevent directory traversal)if {![regexp {^([^\./ ]+)\s+([^\./ ]+)$} $arg arg dir file]} {error "invalid category or subcategory"}set dir [file join $basedir $dir]if {![file isdir $dir]} {error "invalid category"}set file [file join $dir $file$fileext]if {![file isfile $file]} {error "invalid subcategory"}split [read -nonewline [set file [open $file]]][close $file] \n}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Jan 18, 2008 7:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[r0t3n]]></name></author>
		<updated>2008-01-17T14:56:44-04:00</updated>

		<published>2008-01-17T14:56:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80160#p80160</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80160#p80160"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80160#p80160"><![CDATA[
Take a look at <a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">http://forum.egghelp.org/viewtopic.php?t=6885</a> for basic file operations, then modify one of the scripts you have found to your requirements. Learn the file commands to grab the contents of a dir and display the list of subdirs, and the contents of the file(s) you want to display along with foreach loop for your line-to-line output.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6300">r0t3n</a> — Thu Jan 17, 2008 2:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Faraibi]]></name></author>
		<updated>2008-01-17T08:23:44-04:00</updated>

		<published>2008-01-17T08:23:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80147#p80147</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80147#p80147"/>
		<title type="html"><![CDATA[Need a script to display txt files from subdirs to a channel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80147#p80147"><![CDATA[
Hi all,<br>i searched the whole day for a script on the egghelp.org tcl archive and on this forum also, i found some scripts very useful but dint get what i need actually.<br><br>actually what i have is subdirectories in a directory, so i want to specify different subdirectories in a single directory for different contents in the script:<br><br>e.g<br>sports "base_dir/sports/"<br>games "base_dir/games/"<br><br>and the text files will be in these subdirectories. when the user do this on a channel !menu or !options or any trigger the bot displays the available subdirectories (sports, games etc) and then the user can get the list !list sports or !list games, that will list the files in that subdirectory and when the user do this !display sports cricket, the bot will display the contents of cricket.txt, line by line (every next line after some seconds 5..6 seconds), that is in sports subdirectory.<br><br>and a mastershutdown of this tcl would help .. so that users dont get the bot to flood... <br><br><br>I know it's a bit complicated and thanks for reading this request <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=9378">Faraibi</a> — Thu Jan 17, 2008 8:23 am</p><hr />
]]></content>
	</entry>
	</feed>
