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

	<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>2012-05-09T11:08:12-04:00</updated>

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

		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-05-09T11:08:12-04:00</updated>

		<published>2012-05-09T11:08:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99369#p99369</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99369#p99369"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99369#p99369"><![CDATA[
hey caesar I have another question if possible,<br><br>Would it be difficult for you to configure that script that from the time I write, the script will write every X mins the lines from the script one by one untill he's finishing?<br><br>&lt;User&gt; !play 21:30 2 Randomchat.txt #World<br><br>[21:30] &lt;Bot&gt; This is the randomchat file<br>[21:32] &lt;Bot&gt; this is line #2 from randomchat.txt<br>[21:34] &lt;Bot&gt; this is line #3 from randomchat.txt<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Wed May 09, 2012 11:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-05-04T06:09:04-04:00</updated>

		<published>2012-05-04T06:09:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99339#p99339</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99339#p99339"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99339#p99339"><![CDATA[
Thanks caesar and speechles<br><br>The script works perfectly now!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Fri May 04, 2012 6:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-04T05:35:25-04:00</updated>

		<published>2012-05-04T05:35:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99338#p99338</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99338#p99338"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99338#p99338"><![CDATA[
Here is a better version of the above code.<div class="codebox"><p>Code: </p><pre><code>namespace eval cronPlay {  bind pub * !play [namespace current]::create  proc create {nick uhost hand chan text} {    variable play    if {[scan $text {%[^:]:%s%s%s} hour minute file channel] != 4} {      puthelp "NOTICE $nick :Usage: !play &lt;hour:minute&gt; &lt;file&gt; &lt;#channel&gt;"      return    }    if {![regexp {^[0-9]+$} $hour] || ![regexp {^[0-9]+$} $minute]} {      puthelp "NOTICE $nick :Error, the hour or minute aren't valid."      return    }    if {![file exists $file]} {      puthelp "NOTICE $nick :Error, $file file doesn't exist."      return    }    switch -- [catch {botisop $channel} err] {      "0" {        if {!$err} {          puthelp "NOTICE $nick :I won't be able to play the $file file in $channel channel if I'm not oped."            return        }      }      "1" {        puthelp "NOTICE $nick :Error, $channel channel is not valid."        return      }    }    set play(info) "$file $channel"    scan $hour %d hour    scan $minute %d minute    bind cron - "$minute $hour * * *" [namespace current]::play    puthelp "PRIVMSG $chan :I will play $file to $channel at $hour:$minute"  }  proc play {minute hour day month weekday} {    variable play    scan $minute %d minute    scan $hour %d hour    if {[catch {unbind cron - "$minute $hour * * *" [namespace current]::play} err]} {      putlog "Error in cronPlay: $err"    }    if {[scan $play(info) {%s%s} file channel] != 2} return    if {![file exists $file]} return    set fo [open $file]    set lines [split [read -nonewline $fo] \n]    close $fo    if {![llength $lines]} return    if {![catch {botisop $channel} err] &amp;&amp; $err eq 1} {      puthelp "MODE $channel +m"      foreach line $lines {        puthelp "PRIVMSG $channel :$line"      }      puthelp "MODE $channel -m"    }  }}putlog "cronPlay.tcl loaded.."</code></pre></div>The only issue I will try to solve later on is that you can trigger the same cron multiple times.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri May 04, 2012 5:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-04T01:21:48-04:00</updated>

		<published>2012-05-04T01:21:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99333#p99333</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99333#p99333"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99333#p99333"><![CDATA[
I have just noticed that I forgot to add a return after the channel validation check and corrected a few other things that where missing when initially wrote the code. All have been fixed now. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Also, changed the <em class="text-italics">pushmode</em> to <em class="text-italics">puthelp</em> as it didn't set the +m in time.<blockquote class="uncited"><div>[08:13] &lt;caesar&gt; !play  08:14 preview.txt #channel<br>[08:13] &lt;@bot&gt; I will play preview.txt to #channel at  08:14<br>[08:14] * bot sets mode: +m<br>[08:14] &lt;@bot&gt; line 1<br>[08:14] &lt;@bot&gt; line 2<br>[08:14] &lt;@bot&gt; line 3<br>[08:14] * bot sets mode: -m</div></blockquote>The code as it is right now, the bot will play the file (only if it file exists and isn't empty) at the time you wanted if the bot has op on the channel.<br><br>Please do keep in mind that this isn't fool proof (yet) and the time has to be in two digits format, example: 09:12, 15:03.<br><br>Edit: To make it ignore the format you pick for time, meaning make it fool proof and accept 09:12 and 9:12 or 15:03 and 15:3 then do the following changes to the above code.<br><br>Replace:<div class="codebox"><p>Code: </p><pre><code>    if {![regexp {^[0-9]+$} $hour] || ![regexp {^[0-9]+$} $minute]} {      puthelp "NOTICE $nick :Error, the hour or minute aren't valid."      return    }</code></pre></div>with:<div class="codebox"><p>Code: </p><pre><code>    if {![regexp {^[0-9]+$} $hour] || ![regexp {^[0-9]+$} $minute]} {      puthelp "NOTICE $nick :Error, the hour or minute aren't valid."      return    } else {scan $hour %d hourscan $minute %d minute}</code></pre></div>and before the:<div class="codebox"><p>Code: </p><pre><code>if {[catch {unbind cron - "$minute $hour * * *" [namespace current]::play} err]} {</code></pre></div>line add the following:<div class="codebox"><p>Code: </p><pre><code>scan $minute %d minutescan $hour %d hour</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri May 04, 2012 1:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-05-03T12:34:30-04:00</updated>

		<published>2012-05-03T12:34:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99328#p99328</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99328#p99328"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99328#p99328"><![CDATA[
Hey guys,<br><br>Thanks for the reply.<br><br>I've tried this<br>[19:23:23] &lt;@Nascimento&gt; !play 16:30 preview.txt #moderators<br><br>Didn't get any errors - but it didn't set +m or -m and it didn't play the file either..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Thu May 03, 2012 12:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-02T13:00:36-04:00</updated>

		<published>2012-05-02T13:00:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99318#p99318</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99318#p99318"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99318#p99318"><![CDATA[
Oh snap.. Forgot a ! in the <em class="text-italics">validchan</em> check. It should work fine now. As for <em class="text-italics">flushmode</em> to be honest I would rather change the pushmode with a putserv or even a putquick if it's really necessarily. Just test it and let me know if the bot doesn't set +m before starting to play the file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed May 02, 2012 1:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2012-05-02T12:56:59-04:00</updated>

		<published>2012-05-02T12:56:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99317#p99317</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99317#p99317"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99317#p99317"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[validchan $channel]} { </code></pre></div>Change that to...<div class="codebox"><p>Code: </p><pre><code>if {![validchan $channel]} { </code></pre></div>That.. Now it'll work and wont say a valid chan isn't valid. The logic of that statement was backwards...<br><br>and this part needs changing...<div class="codebox"><p>Code: </p><pre><code>      pushmode $channel +m      foreach line $lines {         puthelp "PRIVMSG $channel :$line"      }      pushmode $channel -m </code></pre></div>To this....<br><div class="codebox"><p>Code: </p><pre><code>      pushmode $channel +m      flushmode $channel      foreach line $lines {         puthelp "PRIVMSG $channel :$line"      }      pushmode $channel -m      flushmode $channel</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed May 02, 2012 12:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-05-02T03:47:32-04:00</updated>

		<published>2012-05-02T03:47:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99314#p99314</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99314#p99314"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99314#p99314"><![CDATA[
Hey caesar,<br><br>Thanks for the script.<br><br>A couple of things:<br><br>I've tried:<br><br>[10:27:29] &lt;@Nascimento&gt; !play 07:30 preview.txt #taunt<br>[10:27:32] -MI6- Error, #taunt channel is not valid.<br><br>Even though it is a valid channel.<br><br>I tried playing it to myself:<br><br>[10:32:29] &lt;@Nascimento&gt; !play 07:35 preview.txt Nascimento<br><br>That didn't work either.<br><br>I've placed preview.txt in the 'eggdrop' folder<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Wed May 02, 2012 3:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-05-04T02:00:45-04:00</updated>

		<published>2012-05-01T00:46:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99301#p99301</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99301#p99301"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99301#p99301"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>namespace eval cronPlay {  set play(info) ""  bind pub * !play [namespace current]::create  proc create {nick uhost hand chan text} {    variable play    if {[scan $text {%[^:]:%s%s%s} hour minute file channel] != 4} {      puthelp "NOTICE $nick :Usage: !play &lt;hour:minute&gt; &lt;file&gt; &lt;#channel&gt;"      return    }    if {![regexp {^[0-9]+$} $hour] || ![regexp {^[0-9]+$} $minute]} {      puthelp "NOTICE $nick :Error, the hour or minute aren't valid."      return    }    if {![file exists $file]} {      puthelp "NOTICE $nick :Error, $file file doesn't exist."      return    }    if {![validchan $channel]} {      puthelp "NOTICE $nick :Error, $channel channel is not valid."      return    }    set play(info) "$file $channel"    bind cron - "$minute $hour * * *" [namespace current]::play    puthelp "PRIVMSG $chan :I will play $file to $channel at $hour:$minute"  }  proc play {minute hour day month weekday} {    variable play    if {[catch {unbind cron - "$minute $hour * * *" [namespace current]::play} err]} {      putlog "Error in cronPlay: $err"    }    if {[scan $play(info) {%s%s} file channel] != 2} return    if {![file exists $file]} return    set fo [open $file]    set lines [split [read -nonewline $fo] \n]    close $fo    if {![llength $lines]} return    if {[botisop $channel]} {      puthelp "MODE $channel +m"      foreach line $lines {        puthelp "PRIVMSG $channel :$line"      }      puthelp "MODE $channel -m"    }  }}putlog "cronPlay.tcl loaded.."</code></pre></div>Haven't tested so let me know if you get any errors.<br><br>Edit: fixed 3nd time.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue May 01, 2012 12:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-04-30T13:22:58-04:00</updated>

		<published>2012-04-30T13:22:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99296#p99296</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99296#p99296"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99296#p99296"><![CDATA[
Anyone, please?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Mon Apr 30, 2012 1:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BigToe]]></name></author>
		<updated>2012-04-16T06:25:32-04:00</updated>

		<published>2012-04-16T06:25:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99203#p99203</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99203#p99203"/>
		<title type="html"><![CDATA[A Simple play file script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99203#p99203"><![CDATA[
hello<br><br>All I need is rather simple play file script<br>via public command you set the time and the file you want to be played in a channel, the bot will set +m before it plays it, and -m after it finishes to play it<br><br>example here:<br><br>&lt;Me&gt; !play 21:30 Script.txt #ChannelNameHere<br>&lt;Bot&gt; I will play script.txt to #ChannelNameHere at 21:30<br><br>* 21:30 *<br><br>#ChannelNameHere:<br><br>*** Bot sets mode +m<br>&lt;Bot&gt; 1st line from Script.txt<br>&lt;Bot&gt; 2nd line from Script.txt<br>....<br>*** Bot sets mode -m<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11473">BigToe</a> — Mon Apr 16, 2012 6:25 am</p><hr />
]]></content>
	</entry>
	</feed>
