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

	<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-10-18T02:13:41-04:00</updated>

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

		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2010-10-17T03:21:37-04:00</updated>

		<published>2010-10-17T03:21:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94768#p94768</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94768#p94768"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94768#p94768"><![CDATA[
Change <div class="codebox"><p>Code: </p><pre><code>foreach chan [channels] {</code></pre></div> to <div class="codebox"><p>Code: </p><pre><code>foreach channel [channels] {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Sun Oct 17, 2010 3:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2011-10-18T02:13:41-04:00</updated>

		<published>2010-10-16T16:19:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94763#p94763</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94763#p94763"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94763#p94763"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>      if {![channel get $channel newsengine]} {          return 0      }</code></pre></div>if you wish to exit from a loop either use 'break' or 'continue' (self both are explanatory), not 'return'.<br><br>You should move the SQL query outside the while loop and change the 'limit' to suit your needs, meaning it's stupid to do 5 queries when you can do just one to fetch 5 results from the table and then have them parsed how you wish, something like:<div class="codebox"><p>Code: </p><pre><code>querywhile (having results) {parse them}free-up memory and close the mysql connection</code></pre></div>Edit: In mysqlnews.sql I would change from "timestamp bigint(20)" to "timestamp int(10)" if the time is stored in this way.<br><br>Here is my (foolish) attempt on doing this:<div class="codebox"><p>Code: </p><pre><code>bind time - "30 * * * *" autonewsbind time - "00 * * * *" autonewsproc autonews {mins hours days months years} {global db_handle news_noflagsset limit 5foreach channel [channels] {if {![channel get $channel newsengine]} {continue}set results [mysqlquery $db_handle "SELECT id, news, by, FROM_UNIXTIME(timestamp, "%d %b %Y %H:%M") AS when FROM news WHERE channel = $chan ORDER BY id DESC LIMIT $limit"]if {![moreresult $results]} {puthelp "PRIVMSG $channel :Couldn't find any news (try adding news first!)"} else {puthelp "PRIVMSG $channel :NEWS:"while {[set row [mysqlfetch $results]] != ''} {set id [lindex $row 0]set news [lindex $row 1]set by [lindex $row 2]set when [lindex $row 3]puthelp "PRIVMSG $channel :\[\002$id\002\] $when from $by on $chan: $news"}puthelp "PRIVMSG $channel :End of news"}mysqlendquery $results}mysqlclose $db_handle}</code></pre></div>haven't tested it but theoretically should work. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> I'm not 100% sure about the 'FROM_UNIXTIME' thing. Anyway, I would appreciate some feedback on this.<br><br><a href="http://forum.egghelp.org/profile.php?mode=viewprofile&amp;u=2878" class="postlink">user</a> (a very resourceful fountain of information IMHO, too bad he's been idle lately, among others) once <a href="http://forum.egghelp.org/viewtopic.php?p=30768" class="postlink">posted</a> a decr proc you should use in your scripts:<div class="codebox"><p>Code: </p><pre><code>proc decr var {   uplevel 1 [list incr $var -1]}</code></pre></div>Btw, ::mysql::map looks interesting. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Edit: Ahh, updated. Thanks username. <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> — Sat Oct 16, 2010 4:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2010-10-16T13:56:46-04:00</updated>

		<published>2010-10-16T13:56:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94760#p94760</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94760#p94760"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94760#p94760"><![CDATA[
<blockquote class="uncited"><div>great work thx <br><br><br>now i have another problem ...if no news in the database the bot is posting <br><br>Couldn't find any news (try adding news first!)<br><br>is it possible if no news in the databse the bot is nothing to announce ?</div></blockquote>Im my code chnge <div class="codebox"><p>Code: </p><pre><code>puthelp "PRIVMSG $channel :Couldn't find any news (try adding news first!)"</code></pre></div> to <div class="codebox"><p>Code: </p><pre><code>return 0</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Sat Oct 16, 2010 1:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoCooner]]></name></author>
		<updated>2010-10-16T12:09:44-04:00</updated>

		<published>2010-10-16T12:09:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94753#p94753</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94753#p94753"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94753#p94753"><![CDATA[
great work thx <br><br><br>now i have another problem ...if no news in the database the bot is posting <br><br>Couldn't find any news (try adding news first!)<br><br>is it possible if no news in the databse the bot is nothing to announce ?<br><br><br><br>and I find it just on that one! news now can not retrieve it<br><br>[19:43:10] Tcl error [mcpshandlepubOK]: invalid command name "news"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10485">CoCooner</a> — Sat Oct 16, 2010 12:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2010-10-16T11:17:45-04:00</updated>

		<published>2010-10-16T11:17:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94750#p94750</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94750#p94750"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94750#p94750"><![CDATA[
After <div class="codebox"><p>Code: </p><pre><code># ----------------------------------------------------------------------# news# !news#   Querys the last 5 lines of news from the database or the news line #   number entered# ----------------------------------------------------------------------</code></pre></div>add this <div class="codebox"><p>Code: </p><pre><code>bind time - "30 * * * *" autonewsbind time - "00 * * * *" autonewsproc autonews {mins hours days months years} {  global db_handle news_noflags  foreach channel [channels] {      if {![channel get $channel newsengine]} {          return 0      }      set x 5      while {$x &gt; 0} {          set y [expr $x - 1]          set sql "SELECT * FROM news ORDER BY id desc limit $y,1"          putloglev d * "NewsEngine: executing $sql"          set result [mysqlquery $db_handle $sql]              if {$x == 5} {              puthelp "PRIVMSG $channel :NEWS:"          }          if {[set row [mysqlnext $result]] != ""} {              set id [lindex $row 0]              set news [lindex $row 3]              set by [lindex $row 1]              set when [clock format [lindex $row 5] -format "%d %b %Y %H:%M"]              set chan [lindex $row 4]              if {$chan != $channel} {                  puthelp "PRIVMSG $channel :\[\002$id\002\] $when from $by on $chan: $news"              } else {                  puthelp "PRIVMSG $channel :\[\002$id\002\] $when from $by: $news"              }          } else {              if {$x == 1} {                  puthelp "PRIVMSG $channel :Couldn't find any news (try adding news first!)"              }          }          if {$x == 1} {              puthelp "PRIVMSG $channel :End of news"          }          mysqlendquery $result          set x [expr $x - 1]      }  }}</code></pre></div>I didnt test this.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Sat Oct 16, 2010 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoCooner]]></name></author>
		<updated>2010-10-16T07:46:20-04:00</updated>

		<published>2010-10-16T07:46:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94746#p94746</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94746#p94746"/>
		<title type="html"><![CDATA[Add news as auto announce]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94746#p94746"><![CDATA[
hi there <br><br>first sry for my bad english <br><br>i've downloaded an installed the add news script from here<br><a href="http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&amp;id=1268" class="postlink">http://www.egghelp.org/cgi-bin/tcl_arch ... ad&amp;id=1268</a><br><br>works great but is it possible to make this script announce every 30 minutes ? <br><br>maybe with a extra script ? <br>I've tried to contact the coder but unfortunately all his contact types are offline <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10485">CoCooner</a> — Sat Oct 16, 2010 7:46 am</p><hr />
]]></content>
	</entry>
	</feed>
