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

	<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>2009-05-28T10:20:27-04:00</updated>

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

		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-28T10:20:27-04:00</updated>

		<published>2009-05-28T10:20:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88990#p88990</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88990#p88990"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88990#p88990"><![CDATA[
That did it! Thanks!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Thu May 28, 2009 10:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-05-28T10:00:36-04:00</updated>

		<published>2009-05-28T10:00:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88989#p88989</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88989#p88989"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88989#p88989"><![CDATA[
Then what is happening is that the first eggdrop sees the new dj, changes topic, and copies the file... hence the second eggie won't see the new dj.<br><br>You'd either have to use different files for each eggie (topicdj, the lastdj may still remain shared), or you'll have to keep the $tdj in each eggies memory, rather than re-reading it from the file once every minute.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu May 28, 2009 10:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-28T09:56:53-04:00</updated>

		<published>2009-05-28T09:56:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88988#p88988</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88988#p88988"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88988#p88988"><![CDATA[
<blockquote class="uncited"><div>Well, the code is not server-dependant, which suggests an issue with J2 or it's system/account.<br><br>Are both bots running on the same system/account? Are they using the very same topicdj/lastdj files?</div></blockquote>Yes, and yes. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Exact same setup, just a different server and botnet-name.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Thu May 28, 2009 9:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-05-28T09:32:46-04:00</updated>

		<published>2009-05-28T09:32:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88986#p88986</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88986#p88986"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88986#p88986"><![CDATA[
Well, the code is not server-dependant, which suggests an issue with J2 or it's system/account.<br><br>Are both bots running on the same system/account? Are they using the very same topicdj/lastdj files?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu May 28, 2009 9:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-28T00:28:40-04:00</updated>

		<published>2009-05-28T00:28:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88979#p88979</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88979#p88979"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88979#p88979"><![CDATA[
Well, the script is still working great, except for one minor little problem that just popped up today...<br><br>On DALnet (our "home" server), the script runs fine (on bot J1). But on EFnet (on bot J2), it doesn't run period. No error message, no nothing. The bots are linked correctly, and relaying fine. Other scripts run fine as well.<br><br>Any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Thu May 28, 2009 12:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-10T11:38:18-04:00</updated>

		<published>2009-05-10T11:38:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88723#p88723</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88723#p88723"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88723#p88723"><![CDATA[
<blockquote class="uncited"><div>I'd suggest you do not use "string match" here, but rather "string compare" or "string equal". "match" should only be used when pattern matching is needed, not literary matching.</div></blockquote>It works! Thanks!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Sun May 10, 2009 11:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-05-10T09:42:19-04:00</updated>

		<published>2009-05-10T09:42:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88719#p88719</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88719#p88719"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88719#p88719"><![CDATA[
I'd suggest you do not use "string match" here, but rather "string compare" or "string equal". "match" should only be used when pattern matching is needed, not literary matching.<br><br>The load impact of using utimer instead of timer would be minimal. For best performance and reliability, I'd rather recommend the time binding.<br>Also, you both forgot to restart the timer in the case of both files matching.<br><div class="codebox"><p>Code: </p><pre><code>bind time - * checktopicproc checktopic {args} {  set cdjf [open "/usr/local/autodj/tmp/lastdj" r]  set cdj [read -nonewline $cdjf]  close $cdjf  set tdjf [open "/usr/local/autodj/tmp/topicdj" r]  set tdj [read -nonewline $tdjf]  close $tdjf  if {[string equal $tdj $cdj]} {    putlog "Same DJ, no change - $cdj"  } else {    putserv "TOPIC #KJSR :KJSR.net - The Voice of Jello Shooters - $cdj"    file copy --force "/usr/local/autodj/tmp/lastdj" "/usr/local/autodj/tmp/topicdj"  }}</code></pre></div>Also took the liberty of simply copying the lastdj file to topicdj file, rather than the "cumbersome" file operations of rewriting it's content.<br><br>Finally, since you're using timers, make sure you don't have several timers running at the same time, as this will cause your behaviour of "changing topic twice"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun May 10, 2009 9:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-10T00:19:18-04:00</updated>

		<published>2009-05-10T00:19:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88718#p88718</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88718#p88718"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88718#p88718"><![CDATA[
<blockquote class="uncited"><div>it's better in this case to use timer rather than utimer to track 60 seconds/1 minute. Utimer will check for matches each second that passes, so even if it isn't triggered it still evaluates this every second. Timer runs against minutes, and theoretically saves your bot 59 evaluations every minute.</div></blockquote>Well, it's almost working. Except it's triggering every minute and changing the topic twice.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Sun May 10, 2009 12:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-05-10T00:02:37-04:00</updated>

		<published>2009-05-10T00:02:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88717#p88717</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88717#p88717"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88717#p88717"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># interval in minutes at which to refresh topicvariable dj_refresh 1proc checktopic { } {  set cdjf [open "/usr/local/autodj/tmp/lastdj" r]  set cdj [read -nonewline $cdjf]  close $cdjf  set tdjf [open "/usr/local/autodj/tmp/topicdj" r]  set tdj [read -nonewline $tdjf]  close $tdjf  if {[string match $tdj $cdj]} {    putlog "Same DJ, no change - $cdj"  } else {    putserv "TOPIC #KJSR :KJSR.net - The Voice of Jello Shooters - $cdj"    set tdjf [open "/usr/local/autodj/tmp/topicdj" w]    puts $tdjf $cdj    close $tdjf    timer $::dj_refresh [list checktopic]  }}timer $dj_refresh [list checktopic] </code></pre></div>it's better in this case to use timer rather than utimer to track 60 seconds/1 minute. Utimer will check for matches each second that passes, so even if it isn't triggered it still evaluates this every second. Timer runs against minutes, and theoretically saves your bot 59 evaluations every minute.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun May 10, 2009 12:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DJCharlie]]></name></author>
		<updated>2009-05-09T22:59:04-04:00</updated>

		<published>2009-05-09T22:59:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88716#p88716</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88716#p88716"/>
		<title type="html"><![CDATA[Change Topic based on a text file every 60 seconds?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88716#p88716"><![CDATA[
Okay, let me preface this by saying that I'm totally new to eggdrops in general, and scripting tcl in particular.<br><br>Now then.. I'm trying to write a script that every 60 seconds reads 2 text files, and if the contents of those files are equal, do nothing. BUT, if they're different, incorporate the line from the first file into the channel topic.<br><br>Here's what I've got so far:<br><div class="codebox"><p>Code: </p><pre><code>proc checktopic {} {  set cdjf [open "/usr/local/autodj/tmp/lastdj" r]  while {[eof $cdjf] !=1} {    set cdj [gets $cdjf]  }  close $cdjf  set tdjf [open "/usr/local/autodj/tmp/topicdj" r]  while {[eof $tdjf] !=1} {    set tdj [gets $tdjf]  }  close $tdjf  if {$cdj == $tdj} {    putlog "Same DJ, no change - $cdj"    break  } else {    putserv "TOPIC #KJSR :KJSR.net - The Voice of Jello Shooters - $cdj"    set tdjf [open "/usr/local/autodj/tmp/topicdj" w]    puts $tdjf $cdj    close $tdjf    utimer 60 [list checktopic]  }}utimer 60 [list checktopic]</code></pre></div>And here's what it's outputting:<br><div class="codebox"><p>Code: </p><pre><code>&lt;JohnnyFever&gt; [22:49] Same DJ, no change -&lt;JohnnyFever&gt; [22:49] Tcl error in script for 'timer1494':&lt;JohnnyFever&gt; [22:49] invoked "break" outside of a loop</code></pre></div>It never runs again until I rehash.<br><br>And what's worse, is the contents of the two files are different, so it SHOULD be changing the topic.<br><br>Can anyone tell me where I screwed up? Thanks in advance.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10641">DJCharlie</a> — Sat May 09, 2009 10:59 pm</p><hr />
]]></content>
	</entry>
	</feed>
