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

	<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>2010-06-07T08:39:58-04:00</updated>

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

		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2010-06-07T08:39:58-04:00</updated>

		<published>2010-06-07T08:39:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93267#p93267</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93267#p93267"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93267#p93267"><![CDATA[
<blockquote class="uncited"><div>no need to quote that much!</div></blockquote>Thanks! <br><br>I was getting this error though on the loading of the script<br><br>invalid command name "UPDATE CC_users SET onirc = 'no' WHERE ircname = 'ToonHead'" while executing ""UPDATE CC_users SET onirc = 'no' WHERE ircname = '$nick'" \ " invoked from within "set db_sqllist [list "UPDATE CC_users SET onirc = 'no' WHERE username = '$nick' " \ "UPDATE CC_users SET onirc = 'no' WHERE ircna..."  (file "scripts/ircidle.tcl" line 183)<br><br>so I changed it to <div class="codebox"><p>Code: </p><pre><code>set lista "UPDATE CC_users SET onirc = 'no' WHERE username = '$nick'"set listb "UPDATE CC_users SET onirc = 'no' WHERE ircname = '$nick'"set listc "UPDATE CC_users SET onirc = 'yes' WHERE username = '$newnick'"set listd "UPDATE CC_users SET onirc = 'yes' WHERE ircname = '$newnick'"set db_sqllist [list lista listb listc listd] </code></pre></div>But.. now I'm getting the error that the 2nd procedure doesn't know what the $mode is..<br><div class="codebox"><p>Code: </p><pre><code>proc db_handle_voicer {mode id channel nick newnick} {    switch -- $mode {       "-"   { puthelp "PRIVMSG $channel :User Offline: \002$nick\002 - IRC bonus disabled." }       "+"   ( puthelp "PRIVMSG $channel :User Online: \002$newnick\002 - IRC bonus enabled." }    }    pushmode $channel ${mode}v $newnick    return }</code></pre></div>I tried adding global mode, but that didn't help. It didn't know channel either, but i added a set channel statement, then added global channel.  I can see the mode is being passed to the procedure.. so why doesn't it know? <br><br>the error is: <br><em class="text-italics">can't read "mode": no such variable while executing "pushmode $channel ${mode}v $newnick " (file "scripts/ircidle.tcl" line 232) invoked from within "source scripts/ircidle.tcl"</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Mon Jun 07, 2010 8:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-06-06T23:26:54-04:00</updated>

		<published>2010-06-06T23:26:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93264#p93264</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93264#p93264"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93264#p93264"><![CDATA[
<blockquote class="uncited"><div>Btw, you should use:<div class="codebox"><p>Code: </p><pre><code>if {![isbotnick $nick]} {return 0}</code></pre></div>instead of:<div class="codebox"><p>Code: </p><pre><code>if {$nick==$botnick} {return 0} </code></pre></div></div></blockquote>caesar, closely look at your post above. heh. I'm sure you meant this instead.<div class="codebox"><p>Code: </p><pre><code>if {[isbotnick $nick]} {return 0}</code></pre></div><br>and something like this is easier, since most of those nested if's simply do the same thing you can create sub procedures to make it easier to understand the code without needing those comments. A simple list to hold those sql commands makes it easier.<div class="codebox"><p>Code: </p><pre><code>set db_sqllist [list "UPDATE CC_users SET onirc = 'no' WHERE username = '$nick'" \                     "UPDATE CC_users SET onirc = 'no' WHERE ircname = '$nick'" \                     "UPDATE CC_users SET onirc = 'yes' WHERE username = '$newnick'" \                     "UPDATE CC_users SET onirc = 'yes' WHERE ircname = '$newnick'"]proc nick_main {nick uhost handle channel newnick} {global db_handleif {[isbotnick $nick]} {return 0}if {[db_handle_helper 1 0] != 1} {if {[db_handle_helper 2 1] != 1} {if {[db_handle_helper 3 2] != 1} {if {[db_handle_heler 4 3] != 1} {putlog "SQL - Error"} else {db_handle_voicer "+" [mysqlinsertid $db_handle] $channel $nick $newnick}} else {db_handle_voicer "+" [mysqlinsertid $db_handle] $channel $nick $newnick}} else {db_handle_voicer "-" [mysqlinsertid $db_handle] $channel $nick $newnick}} elseif {[db_handle_helper "irc" 3] != 1} {db_handle_voicer "-" [mysqlinsertid $db_handle] $channel $nick $newnick}} proc db_handle_helper {s call} {global db_handle db_sqllistset sql [lindex $db_sqllist $call]putlog "SQL$s: $sql"putloglev d * "ircstats: executing $sql"set result [mysqlexec $db_handle $sql]putlog "result$s: $result"return $result}proc db_handle_voicer {mode id channel nick newnick} {switch -- $mode {"-"{ puthelp "PRIVMSG $channel :User Offline: \002$nick\002 - IRC bonus disabled." }"+"( puthelp "PRIVMSG $channel :User Online: \002$newnick\002 - IRC bonus enabled." }}pushmode $channel ${mode}v $newnickreturn}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Jun 06, 2010 11:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2010-06-06T14:47:56-04:00</updated>

		<published>2010-06-06T14:47:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93254#p93254</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93254#p93254"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93254#p93254"><![CDATA[
Btw, you should use:<div class="codebox"><p>Code: </p><pre><code>if {![isbotnick $nick]} {return 0}</code></pre></div>instead of:<div class="codebox"><p>Code: </p><pre><code>if {$nick==$botnick} {return 0} </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Jun 06, 2010 2:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2010-06-05T18:14:52-04:00</updated>

		<published>2010-06-05T18:14:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93248#p93248</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93248#p93248"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93248#p93248"><![CDATA[
doh!<br><br>thanks.. getting a new error now, but I will continue to trouble shoot.. at least this error I can work with!!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Sat Jun 05, 2010 6:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-06-05T18:04:39-04:00</updated>

		<published>2010-06-05T18:04:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93247#p93247</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93247#p93247"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93247#p93247"><![CDATA[
You can't use // for comments... Only # will work for comments.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jun 05, 2010 6:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2010-06-05T17:16:12-04:00</updated>

		<published>2010-06-05T17:16:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93245#p93245</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93245#p93245"/>
		<title type="html"><![CDATA[IRC Online Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93245#p93245"><![CDATA[
This is similar to irc idle script., but we've modified it so that when people use alternate nicks in IRC, it works to show people 'online' on a website. <br><br>so.. we got the join, sign and part procedures changed without a problem, but the nick change we're struggling. <br><br>Essentially.. if a person is using their USERNAME nick or their IRCNAME nick (thats the field names in the SQL database) , and changes their nick to something other than USERNAME, or IRCNAME, it says they are offline. <br>If they change their nick to USERNAME, it marks them online. If they change their nick to their IRCNAME, it marks them online. <br><br>Below is the procedure for the nick change. I know the binding works, because before we implemented the alternate nick with IRCNAME, it worked fine. <br><br>Right now, <br><br>If I change my nick in irc, i get this error: (regardless what my current nick is or going to be).  I can't figure out what is creating this error!<br><br>Tcl error [nick_main]: wrong # args: should be "set varName ?newValue?"<br><div class="codebox"><p>Code: </p><pre><code>proc nick_main {nick uhost handle channel newnick} {global db_handle botnick  if {$nick==$botnick} {return 0}# first section is the check if your existing nick (before change) now matches username or IRC name, or no longer matches irc name or user name.  set sql "UPDATE CC_users SET onirc = 'no' WHERE username = '$nick'"  // check if existing nick (before change) matches username then make it NO!  putlog "Step 1: $sql"  putloglev d * "ircstats: executing $sql"  putlog "Step 2: $result"  set result [mysqlexec $db_handle $sql]    if {$result != 1} {              // existing nick doesn't exist in the database so this triggers If statement...    set sql2 "UPDATE CC_users SET onirc = 'no' WHERE ircname = '$nick'"  // check if existing nick (before change) matches ircname then make it No!    putlog "SQL2: $sql2"    putloglev d * "ircstats: executing $sql2"    set result2 [mysqlexec $db_handle $sql2]    putlog "result2: $result2"        if {$result2 != 1} {                // existing nick doesn't match ircname either... So.. lets check if the newnick matches username              set sql3 "UPDATE CC_users SET onirc = 'yes' WHERE username = '$newnick'"   //check newnick if it matches username              putlog "SQL3: $sql3"              putloglev d * "ircstats: executing $sql3"              set result3 [mysqlexec $db_handle $sql3]              putlog "result3: $result3"                        if {$result3 != 1} {                // new nick doesn't match username, so.. lets check if the newnick matches ircname                        set sql4 "UPDATE CC_users SET onirc = 'yes' WHERE ircname = '$newnick'"    //check if newnick matches ircname                        putlog "SQL4: $sql4"                        putloglev d * "ircstats: executing $sql4"                        set result4 [mysqlexec $db_handle $sql4]                        putlog "result4: $result4"                               if {$result4 != 1} {  // new nick doesn't match ircname either                               putlog "SQL - Error"  // sucks to be you.. no idle bonus for you!                               } else {         // but WAIT newnick matched ircname!!  give him his bonus!                               set id [mysqlinsertid $db_handle]                               puthelp "PRIVMSG $channel :User Online: \002$newnick\002 - IRC bonus enabled."                               pushmode $channel +v $newnick                               }                        } else {                // // but WAIT newnick matched username!!  give him his bonus!                        set id [mysqlinsertid $db_handle]                        puthelp "PRIVMSG $channel :User Online: \002$newnick\002 - IRC bonus enabled."                        pushmode $channel +v $newnick                        }              } else {                // // but WAIT original nick matched ircname!!  so disable his bonus since he just changed from it              set id [mysqlinsertid $db_handle]              puthelp "PRIVMSG $channel :User Offline: \002$nick\002 - IRC bonus disabled."              pushmode $channel -v $newnick              }    } else {                // // but WAIT original nick matched username!!  Does New Nick Match ircname?      set sqlirc "UPDATE CC_users SET onirc = 'yes' WHERE ircname = '$newnick'"      putlog "SQLirc: $sqlirc"      putloglev d * "ircstats: executing $sqlirc"      set resultirc [mysqlexec $db_handle $sqlirc]      putlog "resultirc: $resultirc"             if {$resultirc != 1} {                set id [mysqlinsertid $db_handle]                puthelp "PRIVMSG $channel :User Offline: \002$nick\002 - IRC bonus disabled."                pushmode $channel -v $newnick             }       }  }</code></pre></div>All help is appreciated! I've been working on this for days now<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Sat Jun 05, 2010 5:16 pm</p><hr />
]]></content>
	</entry>
	</feed>
