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

	<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>2020-05-16T14:34:46-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2020-05-13T09:55:11-04:00</updated>

		<published>2020-05-13T09:55:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108409#p108409</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108409#p108409"/>
		<title type="html"><![CDATA[[SOLVED]Dont add whats already there]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108409#p108409"><![CDATA[
If you don't use '-flatlist' at you select, then it will return 0 if there's no match or the amount of results in the select.<br><br>For example:<div class="codebox"><p>Code: </p><pre><code>% ::mysql::sel $con "SELECT title FROM books WHERE id= '5'"1% ::mysql::sel $con "SELECT title FROM books WHERE id = '123'"0%  ::mysql::sel $con "SELECT title FROM books"5</code></pre></div>I would pair the <em class="text-italics">sel</em> with <em class="text-italics">map</em> so instead of:<div class="codebox"><p>Code: </p><pre><code>set query1 [::mysql::sel $con "SELECT info,nick,unixtime FROM testbook WHERE info = '$info'" -flatlist];   if {"$query1" !=""} {  foreach {info nick timestamp} $query1 {  putlog "Book Info: $info / $nick / $timestamp "    set addedago [getadded $timestamp]   puthelp "PRIVMSG $chann_(rls) \0037Book Info\003:\0039$info\003 \0037Allerede Startet Af\003 -&gt; $nick  \[ $addedago \]"   putlog "Book Info: $info / $nick / $addedago "    } </code></pre></div>would turn it into:<div class="codebox"><p>Code: </p><pre><code>set count [::mysql::sel $con "SELECT info,nick,unixtime FROM testbook WHERE info = '$info'"]if {$count} {::mysql::map $con {info user time} {putlog "Book Info: $info / $user / $time"set when [getadded $time]puthelp "PRIVMSG $chann_(rls) \0037Book Info\003:\0039$info\003 \0037Allerede Startet Af\003 -&gt; $user  \[ $when\]"putlog "Book Info: $info / $user / $when"}}</code></pre></div>basically should have the same functionality.<br><br>Edit: You realize that you can use just one 'clock format' to show the date and time and don't need two of them, right?<br><br>I mean instead of:<div class="codebox"><p>Code: </p><pre><code>[clock format $time -format %d-%m-%Y] [clock format $time -format %H:%M:%S]</code></pre></div>can go with:<div class="codebox"><p>Code: </p><pre><code>[clock format $time -format "%d-%m-%Y @ %H:%M:%S"]</code></pre></div>result being:<div class="codebox"><p>Code: </p><pre><code>% clock format [clock scan now] -format "%d-%m-%Y @ %H:%M:%S"13-05-2020 @ 17:13:03</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed May 13, 2020 9:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2020-05-16T14:34:46-04:00</updated>

		<published>2020-05-12T06:58:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=108408#p108408</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=108408#p108408"/>
		<title type="html"><![CDATA[[SOLVED]Dont add whats already there]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=108408#p108408"><![CDATA[
I have this script made by ceasar<br><br>I would like it to reply back when another user adds to the dbase with already added info. Like !start 'that have been made'<br><br>then it should reply back in chan: 'that is already added'<br><br>and IF it's not in the dbase, it should add like it already does?<br><br>I am thinking 'string match' / 'string first' ?<br><div class="codebox"><p>Code: </p><pre><code>proc infoadd {nick uhost handle chan text} { if {![channel get [string tolower $chan] rlsAdd]} { return 0 } global dbInfo chann_   if {[scan $text {%s} info] != 1} {      putserv "NOTICE $nick :Usage: !start &lt;info&gt;"      return   }   variable dbInfo   if {[scan $dbInfo %s%s%s%s hostname username password database] != 4} return   set time [unixtime]      set info [::mysql::escape $info]   set nick [::mysql::escape $nick]     set con [::mysql::connect -host $hostname -user $username -password $password -db $database]   set query1 [::mysql::sel $con "SELECT info,nick,unixtime FROM testbook WHERE info = '$info'" -flatlist];   if {"$query1" !=""} {  foreach {info nick timestamp} $query1 {  putlog "Book Info: $info / $nick / $timestamp "    set addedago [getadded $timestamp]   puthelp "PRIVMSG $chann_(rls) \0037Book Info\003:\0039$info\003 \0037Allerede Startet Af\003 -&gt; $nick  \[ $addedago \]"   putlog "Book Info: $info / $nick / $addedago "    }  } else {      set query [::mysql::query $con "INSERT INTO testbook (id,unixtime,info,nick) VALUES (NULL, UNIX_TIMESTAMP(), '$info', '$nick')"]      puthelp "PRIVMSG $chann_(rls) :\0037Book Info\003:\0039 $info\003 \0037Added by\003 $nick =&gt; \[\00314TiME:\003 [clock format $time -format %d-%m-%Y] [clock format $time -format %H:%M:%S] \]"      putlog "Book Info: $info / $nick / $time "  }   ::mysql::endquery $con   ::mysql::close $con}#END</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Tue May 12, 2020 6:58 am</p><hr />
]]></content>
	</entry>
	</feed>
