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

	<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-08-15T01:59:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-15T01:59:48-04:00</updated>

		<published>2008-08-15T01:59:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84604#p84604</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84604#p84604"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84604#p84604"><![CDATA[
yeah it works thx a lot :)<br><br>here the script fpr those who want to try it, too<br><div class="codebox"><p>Code: </p><pre><code> MySQL hostnameset db(host) "localhost"# MySQL userset db(id) "user"# MySQL passwordset db(pass) "pass"# MySQL databaseset db(dbase) "dbase"# load the mysqltcl interfacepackage require mysqltclbind time - "* * * * *" news_postset db_handle [mysqlconnect -host $db(host) -user $db(id) -password $db(pass) -db $db(dbase)]set news_version "1.0"setudef flag newsengine# --------------------------------------------------------------------# news_post#  jede Minute die aktuellen Nachrichten ausspucken# --------------------------------------------------------------------proc news_post {minute hour day month year} {  global db_handle news_noflags    set sql "SELECT text FROM geschichte ORDER BY geschichte_id desc limit 1"    #putloglev d * "NewsEngine: executing $sql"    set result [mysqlquery $db_handle $sql]    if {[set row [mysqlnext $result]] != ""} {      set text [lindex $row 0]      puthelp "PRIVMSG #elygor : $text"    }    else {      puthelp "PRIVMSG $channel :Es ist nichts passiert!"    }    mysqlendquery $result}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Fri Aug 15, 2008 1:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-08-14T18:21:19-04:00</updated>

		<published>2008-08-14T18:21:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84595#p84595</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84595#p84595"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84595#p84595"><![CDATA[
Best way is usually to connect to the dcc-chat partyline, as you can setup your console-settings to include tcl errors and other interesting information.<br><br>There is however, one flaw in the script that I overlooked. The proc (function) named news_post has an empty argument list, yet the time binding will try to call it with 5 parameters (minute, hour, day, month, and year). Thus there will be a mismatch...  The same will be true for your pub-binding, which will call the function with 5 parameters (nick, host, handle, channel, text).<br><div class="codebox"><p>Code: </p><pre><code>#change this:proc news_post { } {#into this:proc news_post {minute hour day month year} {</code></pre></div>Although you will get away with it in this script, it is generally a bad idea to use the same function with multiple bindings of different kind, as different kinds of bindings provide different information as parameters, and in many cases, not the same number of parameters.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Aug 14, 2008 6:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-14T18:13:17-04:00</updated>

		<published>2008-08-14T18:13:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84594#p84594</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84594#p84594"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84594#p84594"><![CDATA[
i did so, but nothing happens. i also added<br>bind pub "-|-" !news news_post<br>but when i say !news in channel or private chat nothing happens, too. how can i debug whats going wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Thu Aug 14, 2008 6:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-08-14T18:05:02-04:00</updated>

		<published>2008-08-14T18:05:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84593#p84593</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84593#p84593"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84593#p84593"><![CDATA[
add a source command to your config-file, and restart your eggdrop:<div class="codebox"><p>Code: </p><pre><code>source scripts/yourscript.tcl</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Aug 14, 2008 6:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-14T18:01:09-04:00</updated>

		<published>2008-08-14T18:01:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84592#p84592</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84592#p84592"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84592#p84592"><![CDATA[
Well, I installed the lib and I changed the tcl script? How can I start it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Thu Aug 14, 2008 6:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-08-14T17:56:18-04:00</updated>

		<published>2008-08-14T17:56:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84591#p84591</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84591#p84591"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84591#p84591"><![CDATA[
Yup.<br>As for your posted code, I cannot see any direct flaws in it.<br>One remark however:<div class="codebox"><p>Code: </p><pre><code>load PATH/TO/libmysqltcl.so</code></pre></div>This is not the preferred way of loading mysqltcl, instead, assuming it has been properly installed, use something like this:<div class="codebox"><p>Code: </p><pre><code>package require mysqltcl</code></pre></div><blockquote class="uncited"><div>And where can I get the libmysqltcl.so?</div></blockquote>Link is in my first post, but I'll repeat it here aswell:<br><a href="http://www.xdobry.de/mysqltcl/" class="postlink">http://www.xdobry.de/mysqltcl/</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Aug 14, 2008 5:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-14T17:51:40-04:00</updated>

		<published>2008-08-14T17:51:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84590#p84590</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84590#p84590"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84590#p84590"><![CDATA[
thx for your reply, I guess we wrote simultaniously<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Thu Aug 14, 2008 5:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-08-14T17:50:13-04:00</updated>

		<published>2008-08-14T17:50:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84589#p84589</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84589#p84589"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84589#p84589"><![CDATA[
Tcl has no native support for mysql. There is, however, a package (<a href="http://www.xdobry.de/mysqltcl/" class="postlink">mysqltcl</a>) available for mysql connectivity. This would be loaded as a tcl package (or tcl module, not eggdrop module), and provides a complete API to the tcl environment. There is thus no need to develop your project as a module just for the mysql-support.<br><br>Most, if not all, that takes place within eggdrop is event-driven, so you'll most likely want some hook to trigger your check on a minutely basis. The time binding should do the trick (see doc/tcl-commands.doc for syntax and description). Roughly however, every minute it checks the current time against a given mask. If it matches, the associated code is evaluated.<br><br>I can't think of any specific script that does what you ask for at the moment, although they probably do exist. Since you are new to tcl, I'd suggest starting with a few simple projects just to get accustomed to tcl and it's variable- and namespaces, aswell as eggdrop's extensions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Aug 14, 2008 5:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-14T17:50:22-04:00</updated>

		<published>2008-08-14T17:49:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84588#p84588</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84588#p84588"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84588#p84588"><![CDATA[
Well, I found some parts and mixed them together. What do you think of this? How can I start it? How does my bot to know use this script? I hope I'll find out before wasting your time. And where can I get the libmysqltcl.so?<br><br><br><div class="codebox"><p>Code: </p><pre><code># MySQL hostnameset db(host) "localhost"# MySQL userset db(id) "user"# MySQL passwordset db(pass) "pass"# MySQL databaseset db(dbase) "database"# load the mysqltcl interfaceload PATH/TO/libmysqltcl.sobind time - "* * * * *" news_postset db_handle [mysqlconnect -host $db(host) -user $db(id) -password $db(pass) -db $db(dbase)]set news_version "1.0"setudef flag newsengine# --------------------------------------------------------------------# news_post#  jede Minute die aktuellen Nachrichten ausspucken# --------------------------------------------------------------------proc news_post { } {  global db_handle news_noflags    set sql "SELECT text FROM geschichte ORDER BY geschichte_id desc limit 1"    #putloglev d * "NewsEngine: executing $sql"    set result [mysqlquery $db_handle $sql]    if {[set row [mysqlnext $result]] != ""} {      set text [lindex $row 0]      puthelp "PRIVMSG #elygor : $text"    }    else {      puthelp "PRIVMSG $channel :Es ist nichts passiert!"    }    mysqlendquery $result}</code></pre></div>[/quote][/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Thu Aug 14, 2008 5:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[seeb]]></name></author>
		<updated>2008-08-14T17:12:57-04:00</updated>

		<published>2008-08-14T17:12:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=84587#p84587</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=84587#p84587"/>
		<title type="html"><![CDATA[Tcl script with constant database check]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=84587#p84587"><![CDATA[
hi all,<br>I just installed my first eggdrop bot. I never used tcl and it's some time ago that I programmed something in C.<br>I want to write a small script that checks my mysql database every minute and prints new infos to the channel. is that possible? does anything like this already exist? i found a tcl script which writes data into the DB, but how can I repeat such actions? Do I need a module or is a tcl script enough?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10138">seeb</a> — Thu Aug 14, 2008 5:12 pm</p><hr />
]]></content>
	</entry>
	</feed>
