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

	<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>2011-01-04T06:31:39-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Shimi]]></name></author>
		<updated>2011-01-04T06:31:39-04:00</updated>

		<published>2011-01-04T06:31:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95549#p95549</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95549#p95549"/>
		<title type="html"><![CDATA[help on reading and outputing multiple files]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95549#p95549"><![CDATA[
Hello,<br><br> My friends and I are running an internet radio station and I drew the straw for running our IRC eggdrop bot, so now I am learning how to script in TCL.<br><br>We have severl affiliate channels that have requested a script for runnging ads on their channles as well as on our radio channel.<br><br>I curently have a script I am working on and belive I have a start but would like some assistance if anyone can help me out.<br><br>Since it will be working in multiple channles I curently have it writing indivule files to save the ads for each indivule channle it will display in.<br><br>Here is what i got going so far reading one file. How do I get it to read multiple files and list all the contents of the files to the main room (advert(channel1)). <br><div class="codebox"><p>Code: </p><pre><code># file to store adverts in ?set advert(file1) "room1.advert"set advert(file2) "room2.advert"set advert(file3) "room3.advert"set advert(file4) "room4.advert"# list of channels to announce adverts inset advert(channel1) ""set advert(channel2) ""set advert(channel3) ""set advert(channel4) ""# set number of adverts to show when triggered by timerset advert(showtimer) 15# what delay between the adverts in minutes, 0 disables timed announceset advert(timer1) 0set advert(timer2) 0set advert(timer3) 0set advert(timer4) 0# what delay in minutes from loading this script till it prints the adverts first time, 0 disables timed announceset advert(firstrun) 10# headerstyleset advert(header) "\0034\002NEWS:\002"# dateformat (default is: 06 Nov 03:20) http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm#M6 for helpset advert(dateformat) "%d %b %H:%M"# linestyle, %time %user and %advert are valid cookiesset advert(line) "\[%time\] %user - %advert"proc timer:advert { arg } {        global advert        set fp [open $advert(file) r]        set data [split [read $fp] "\n"]        close $fp        foreach chan [split $advert(channels)] {                putserv "PRIVMSG $chan :$advert(header)"        }        for { set i [expr [llength $data] - 2] } { $i &gt;= [expr [llength $data] - $arg - 1] } { incr i -1 } {                if { [lindex $data $i] != "" } {                        set line [lindex $data $i]                        set output [string map [list "%time" [clock format [lindex $line 0] -format $advert(dateformat)] "%user" [lindex $line 1] "%advert" [lrange $line 2 end]] $advert(line)]                        foreach chan [split $advert(channels)] {                                 putserv "PRIVMSG $chan :$output"                        }                }        }        timer $advert(timer) { timer:advert $advert(showtimer) }}if { ![string match *timer:advert* [utimers]] &amp;&amp; ![string match *timer:advert* [timers]] &amp;&amp; $advert(firstrun) &gt; 0 &amp;&amp; $advert(timer) &gt; 0 } {        timer $advert(firstrun) { timer:advert $advert(showtimer) }}if { ![file isfile $advert(file)] } {        set fp [open $advert(file) w]        close $fp}</code></pre></div><br>also I was wondering if once it reads from the multiple files if there was some way to flood protect it by making it display 3 lines of info then wait 3 minets and display the next 3 lines, ect till all files info has been displayed.<br><br>I really need some help on this one and it will be a great learning experance for me.<br><br>Thank you very much for any assistance.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11477">Shimi</a> — Tue Jan 04, 2011 6:31 am</p><hr />
]]></content>
	</entry>
	</feed>
