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

	<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>2012-04-28T12:23:59-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-04-28T12:23:59-04:00</updated>

		<published>2012-04-28T12:23:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99283#p99283</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99283#p99283"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99283#p99283"><![CDATA[
This is why I don't debug other people code. I forgot to replace <em class="text-italics">rest</em> with <em class="text-italics">text</em>. It should be fine now.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Apr 28, 2012 12:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cerberus]]></name></author>
		<updated>2012-04-28T03:15:56-04:00</updated>

		<published>2012-04-28T03:15:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99278#p99278</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99278#p99278"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99278#p99278"><![CDATA[
caesar - your code fails with error, any ideas??<br><br>Tcl error [msg_+user]: can't read "text": no such variable<br><br>speachless - works perfectly thanks <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=10183">Cerberus</a> — Sat Apr 28, 2012 3:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2012-04-28T12:22:31-04:00</updated>

		<published>2012-04-25T01:47:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99260#p99260</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99260#p99260"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99260#p99260"><![CDATA[
Guess you didn't noticed this part of <em class="text-italics">getchanhost</em> documentation:<blockquote class="uncited"><div>If a channel is not specified, bot will check all of its channels. If the nickname is not on the channel(s), "" is returned. </div></blockquote>So, your foreach loop not only it should break on first match but it's useless by definition.<br><br>Instead of <em class="text-italics">validuser $who</em> I would go with <em class="text-italics">nick2hand</em> as user X may already be a known user to the bot registered when he had a different nick. If you don't want check if that handle already exists, then you should add the user check.<br><br>Here is how I would do this:<div class="codebox"><p>Code: </p><pre><code># Available types are:#   0: *!user@host #   1: *!*user@host #   2: *!*@host #   3: *!*user@*.host #   4: *!*@*.host #   5: nick!user@host #   6: nick!*user@host #   7: nick!*@host #   8: nick!*user@*.host #   9: nick!*@*.host ## You can also specify types from 10 to 19 which correspond to types# 0 to 9, but instead of using a * wildcard to replace portions of the # host, only numbers in hostnames are replaced with the '?' wildcard. # Same is valid for types 20-29, but instead of '?', the '*' wildcard # will be used.set default-mask 1proc msg_+user {nick uhost hand text} {   global default-flags default-mask cmdtbslg   if {![matchattr $hand Q]} {    puthelp "PRIVMSG $nick :$cmdtbslg You haven't authenticate Yourself. Type: \[/msg $botnick auth &lt;password&gt;\] to do so."    return   }   set count [scan $text {%s%s%s} user hostmask flags]   if {!$count} {    puthelp "PRIVMSG $nick :$cmdtbslg Command: /msg $botnick +user &lt;handle&gt; \[hostmask\] \[flags\]"    return   }   if {[llength [nick2hand $user]]} {    puthelp "PRIVMSG $nick :$cmdtbslg $user already exist in my user list."    return      }   if {$count == 1} {    set hostmask [getchanhost $user]    if {[!llength $hostmask]} {        puthelp "PRIVMSG $nick :$cmdtbslg $user is not on my channel(s), a &lt;hostmask&gt; must be included in the command."        return    } else {        set hostmask [maskhost "$user![getchanhost $user]" ${default-mask}]    }   }   if {[scan $hostmask {%[^!]!%[^@]@%s} n u h] != 3} {    puthelp "PRIVMSG $nick :$cmdtbslg Hostmask: \[$hostmask\] is not a valid hostmask."    return   }   adduser $user $hostmask   puthelp "PRIVMSG $nick :$cmdtbslg $user is now added to my user list with hostmask: \[$hostmask\]."   if {$count != 3} {    puthelp "PRIVMSG $nick :$cmdtbslg No user flags included, I'm going to use the standard user flags \[${default-flags}\] for this user."    set flags ${default-flags}   } else {    puthelp "PRIVMSG $nick :$cmdtbslg Adding user $user with $flags flags."   }   chattr $hand $flags   puthelp "PRIVMSG $nick :$cmdtbslg Saving user file."   save   puthelp "NOTICE $hand :Welcome $user pleaase set a password by typing /msg $botnick pass &lt;your new pass&gt;."   puthelp "NOTICE $hand :Once you have set a pass type /msg $::botnick auth &lt;your password&gt; each time you connect to irc to login"   putcmdlog "$cmdtbslg &lt;&lt;$nick&gt;&gt; !$handle! +user $user \[$hostmask\]."}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Apr 25, 2012 1:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2012-04-24T18:54:45-04:00</updated>

		<published>2012-04-24T18:54:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99259#p99259</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99259#p99259"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99259#p99259"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc msg_+user {nick uhost hand rest} {global botnick thehosts default-flags cmdtbslgif {![matchattr $hand Q]} {puthelp "NOTICE $nick :$cmdtbslg You haven't authenticate Yourself. Type: \[/msg $botnick auth &lt;password&gt;\] to do so." ; return 0}set who [lindex [split $rest] 0]if {![string length $who]} { puthelp "NOTICE $nick :$cmdtbslg Command: /msg $botnick +user &lt;handle&gt; \[ip_address\] \[flags\]" ; return 0}if {[validuser $who]} { puthelp "NOTICE $nick :$cmdtbslg $who already exist in my user list." ; return 0}set hostmask [lindex [split $rest] 1]if {![string length $hostmask]} {foreach chan [channels] {if {[onchan $who $chan]} {set hostmask [getchanhost $who $chan] ; set found 1}}if {![info exists found]} {puthelp "NOTICE $nick :$cmdtbslg $who is not on my channel(s), a &lt;hostmask&gt; must be included in the command." ; return 0}set hostmask [maskhost $who!$hostmask]} else {foreach hostsuser $thehosts {set hostuser $hostsuserif {[string equal $hostmask $hostuser]} {puthelp "NOTICE $nick :$cmdtbslg Hostmask: \[$hostmask\] is not a valid hostmask." ; return 0}}}adduser $who $hostmask ; puthelp "NOTICE $nick :$cmdtbslg $who is now added to my user list with hostmask: \[$hostmask\]."set addflags [lindex [split $rest] 2]if {![string length $addflags]} {puthelp "NOTICE $nick :$cmdtbslg No user flags included, I'm going to use my default flag \[${default-flags}\] for this user."set addflags ${default-flags}}chattr $who $addflagsputhelp "NOTICE $nick :$cmdtbslg Standard user's flags $addflags now added for handle: $who ."puthelp "NOTICE $nick :$cmdtbslg Saving user file."saveputhelp "NOTICE $who :Welcome $who pleaase set a password by typing /msg $botnick pass &lt;your new pass&gt;."puthelp "NOTICE $who :Once you have set a pass type /msg $botnick auth &lt;yourpassword&gt; each time you connect to irc to login"putcmdlog "$cmdtbslg &lt;&lt;$nick&gt;&gt; !$hand! +user $who \[$hostmask\]." ; return 0}</code></pre></div>Here is the code corrected. It had several issues besides the one you mentioned. Here it is all cleaned up and ready for the big show.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Tue Apr 24, 2012 6:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cerberus]]></name></author>
		<updated>2012-04-24T15:30:42-04:00</updated>

		<published>2012-04-24T15:30:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99258#p99258</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99258#p99258"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99258#p99258"><![CDATA[
nml375 your awesome that worked perfectly first time and had been blindly staring at that for hours not realising why it failed.<br><br>thanks so much now to sort my other little bug and bot is perfect <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> (new thread for that)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10183">Cerberus</a> — Tue Apr 24, 2012 3:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-04-24T15:11:25-04:00</updated>

		<published>2012-04-24T15:11:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99257#p99257</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99257#p99257"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99257#p99257"><![CDATA[
Ohh, you'll have to replace the "info exists" test with $hostmask == "" in my example<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Apr 24, 2012 3:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cerberus]]></name></author>
		<updated>2012-04-24T15:06:17-04:00</updated>

		<published>2012-04-24T15:06:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99256#p99256</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99256#p99256"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99256#p99256"><![CDATA[
ok will try that thanks have put full code at top now to make debugging easier <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=10183">Cerberus</a> — Tue Apr 24, 2012 3:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-04-24T15:05:23-04:00</updated>

		<published>2012-04-24T15:05:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99255#p99255</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99255#p99255"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99255#p99255"><![CDATA[
Change it to something like this<div class="codebox"><p>Code: </p><pre><code>...foreach chan [channels] {  if {[onchan $who $chan]} {    set hostmask [getchanhost $who $chan]    break  }}if {![info exists hostmask]} {  puthelp "NOTICE $nick :$cmdtbslg Hostmask: \[$hostmask\] is not a valid hostmask."  return 0}...</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Apr 24, 2012 3:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cerberus]]></name></author>
		<updated>2012-04-24T15:00:24-04:00</updated>

		<published>2012-04-24T15:00:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99254#p99254</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99254#p99254"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99254#p99254"><![CDATA[
agreed by how to fix it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10183">Cerberus</a> — Tue Apr 24, 2012 3:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-04-24T14:59:07-04:00</updated>

		<published>2012-04-24T14:59:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99253#p99253</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99253#p99253"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99253#p99253"><![CDATA[
My first guess would be that your test for "onchan $who $chan" fails, having your script return instantly.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Apr 24, 2012 2:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cerberus]]></name></author>
		<updated>2012-04-24T15:05:21-04:00</updated>

		<published>2012-04-24T13:13:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99252#p99252</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99252#p99252"/>
		<title type="html"><![CDATA[adduser help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99252#p99252"><![CDATA[
hope you guys can help i have this in a proc in one of the tcl files, i use but for some reason it only work on first channel bot is on and not all channels<br><div class="codebox"><p>Code: </p><pre><code>proc msg_+user {nick uhost hand rest} {global botnick thehosts default-flags cmdtbslgif {![matchattr $hand Q]} {puthelp "NOTICE $nick :$cmdtbslg You haven't authenticate Yourself. Type: \[/msg $botnick auth &lt;password&gt;\] to do so." ; return 0}set who [lindex $rest 0]if {$who == ""} {puthelp "NOTICE $nick :$cmdtbslg Command: /msg $botnick +user &lt;handle&gt; \[ip_address\] \[flags\]" ; return 0}if {[validuser $who]} {puthelp "NOTICE $nick :$cmdtbslg $who already exist in my user list." ; return 0}set hostmask [lindex $rest 1]if {$hostmask == ""} {foreach chan [channels] {if {[onchan $who $chan]} {set hostmask [getchanhost $who $chan]} else {puthelp "NOTICE $nick :$cmdtbslg $who is not on my channel(s), a &lt;hostmask&gt; must be included in the command." ; return 0}}set hostmask [maskhost $nick!$hostmask]} else {foreach hostsuser $thehosts {set hostuser $hostsuserif {$hostmask == $hostuser} {puthelp "NOTICE $nick :$cmdtbslg Hostmask: \[$hostmask\] is not a valid hostmask." ; return 0}}}adduser $who $hostmask ; puthelp "NOTICE $nick :$cmdtbslg $who is now added to my user list with hostmask: \[$hostmask\]."set addflags [lindex $rest 2]if {$addflags == ""} {puthelp "NOTICE $nick :$cmdtbslg No user flags included, I'm going to use my default flag \[${default-flags}\] for this user."}chattr $who ${default-flags} ; puthelp "NOTICE $nick :$cmdtbslg Standard user's flags ${default-flags} now added for handle: $who ."save ; puthelp "NOTICE $nick :$cmdtbslg Saving user file."puthelp "NOTICE $who Welcome $who pleaase set a password by typing /msg $botnick pass &lt;your new pass&gt;."puthelp "NOTICE $who Once you have set a pass type /msg $botnick auth &lt;yourpassword&gt; each time you connect to irc to login"putcmdlog "$cmdtbslg &lt;&lt;$nick&gt;&gt; !$hand! +user $who \[$hostmask\]." ; return 0}</code></pre></div>it seems to fail at the foreach command but i dont know why can anyone help me out ??<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10183">Cerberus</a> — Tue Apr 24, 2012 1:13 pm</p><hr />
]]></content>
	</entry>
	</feed>
