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

	<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>2015-04-09T16:47:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2015-04-09T16:47:42-04:00</updated>

		<published>2015-04-09T16:47:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103774#p103774</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103774#p103774"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103774#p103774"><![CDATA[
Hi again,<br>Just letting you know I haven't forgotten about this thread, just been rather occupied. I'll see if I can't craft something for you to build on, in the next few days or so.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Apr 09, 2015 4:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-04-06T18:18:14-04:00</updated>

		<published>2015-04-06T18:18:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103759#p103759</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103759#p103759"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103759#p103759"><![CDATA[
<blockquote class="uncited"><div>What you'd really want to do, is have the !fieladd command send the "whois"-instruction, and then let <em class="text-italics">gotraw</em> handle the part of adding the user, etc.<br>.</div></blockquote> Dear <strong class="text-strong">nml375</strong>, first thank you for your quick reply and then tell me your idea seems very good.<br>The issue is that I am newbie in TCL and I dont know how carry your idea into practice.<br><br>If each command (!fieladd,!djadd,!adminadd, !rootadd) used a single process whois, would be excellent for the purpose of not repeating lines.<br><br>Could you help me with the code?  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"><br><br>Edited Reason: my bad english :$<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Mon Apr 06, 2015 6:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2015-04-06T16:50:24-04:00</updated>

		<published>2015-04-06T16:50:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103758#p103758</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103758#p103758"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103758#p103758"><![CDATA[
Hi willyw,<br>Regarding "queueing", the exact implementation would probably depend on the needs of the given application(s).<br><br>A slight example, though:<br>Build a list called <em class="text-italics">rawQueue</em>, where each item is a pair (list) of nickname and "action-proc". Once the "gotraw" proc triggers, extract the nickname from the server-text, and search/iterate through the list, calling each proc with a matching nickname. Once called, do some housekeeping by removing the item from the list.<br>Of course, you could extend the list to match against both nickname and numeric response-code, and you could also add some custom arguments when calling the function, etc, etc<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Apr 06, 2015 4:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2015-04-06T12:31:22-04:00</updated>

		<published>2015-04-06T12:31:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103755#p103755</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103755#p103755"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103755#p103755"><![CDATA[
Hello nml375,<br><br>I was struggling through reading the original posters code, and remembered that I once needed "check if id'd", and compared to my method.  I wrote it.  Seems to work.  (If bot discovers that itself is not id'd, then it sends commands to NS to identify itself)<br><br>I'm glad you replied first, because I couldn't get it into words, and I knew it.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I did it with one proc calling another, and I chose to introduce some delay with utimers.  The idea was to try to allow for the possibility of Nickserv being slow to respond.<br><br>I do have a question though:<br><blockquote class="uncited"><div>... then let <em class="text-italics">gotraw</em> handle the part of adding the user, etc.</div></blockquote>I would be leery of the above, for fear that something someday might trigger it.<br><blockquote class="uncited"><div>Further, the "whois"-instruction might very well be used by other scripts (I don't recall right now if eggdrop uses it itself), so most likely you'll also need some sort of queue for knowing whether this whois-response is related to your script or not.</div></blockquote>This is interesting.   Can you talk more about this queue technique?<br><br><br>I chose to protect against unintended raw bind triggers by unbinding them.<br>That necessitates including the raw binds in a called proc, too.<br>Is this a poor way to go about it?<br><br>Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Mon Apr 06, 2015 12:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2015-04-06T12:01:32-04:00</updated>

		<published>2015-04-06T12:01:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103754#p103754</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103754#p103754"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103754#p103754"><![CDATA[
Hi,<br>First of all, you'll have to change your approach to an asynchronous one. You cannot have <em class="text-italics">add_fan</em> wait for a server response - instead you would have to make sure the check for a registered nick had already been done when <em class="text-italics">add_fan</em> is called.<br><br>What you'd really want to do, is have the !fieladd command send the "whois"-instruction, and then let <em class="text-italics">gotraw</em> handle the part of adding the user, etc.<br><br>Further, the "whois"-instruction might very well be used by other scripts (I don't recall right now if eggdrop uses it itself), so most likely you'll also need some sort of queue for knowing whether this whois-response is related to your script or not.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Apr 06, 2015 12:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-04-05T23:02:58-04:00</updated>

		<published>2015-04-05T23:02:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103752#p103752</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103752#p103752"/>
		<title type="html"><![CDATA[Call and take values from another proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103752#p103752"><![CDATA[
Before you add a user to the staff, the bot should check the nick has to be added is registered in the network.<br><br>I've got a process that performs verification through WHOIS to return zero (0) if the nick is not registered and one (1) if the nick is registered on the network.<br><br>I would call this second process, taking the zero (0) value or a value of one (1) to another process and the truth gives me errors, not knowing invoke the process well.<br><br><span style="text-decoration:underline"><strong class="text-strong">My stuff  </strong></span>:<br><div class="codebox"><p>Code: </p><pre><code>bind pub o|o !fieladd add_fanbind pub o|o !fieldel del_fanbind pub o|o !djadd add_djbind pub o|o !djdel del_djbind pub o|o !adminadd add_adminbind pub o|o !admindel del_adminbind pub n|n !rootadd add_rootbind pub n|n !rootdel del_rootset chan_radio #radioX set chanl_djs #radioX-Djset chan_admin #radioX-adminproc add_fan {nick uhost hand chan text} {  global chan_radio    if {$text == ""} {putmsg $chan "You must enter the nick of the fan to add!";return 0}  set fan [join [lindex [split $text] 0]]####HERE SHOULD BoT CHECK "FAN" IF A REGISTERED NICK, isnot return if yes continue####    putserv "PRIVMSG chan :access $chan_radio add $fan 100"  if {![validuser $fan]} {  adduser $fan  chattr $fan +c   putmsg $chan "You have added a $fan as fan radio"  } else {  if {![matchattr $fan +c]} {   chattr $fan +c   putmsg $chan "You have added a $fan as fan radio";return}  putmsg $chan "$fan was already a fan of the radio!"  }}}proc add_dj {nick uhost hand chan text} {  global chan_radio chan_Dj   if {$text == ""} {putmsg $chan "You must enter the nick of the dj to add!";return 0}  set dj [join [lindex [split $text] 0]]####HERE SHOULD BoT CHECK "DJ" IF A REGISTERED NICK, isnot return if yes continue####    putserv "PRIVMSG chan :access $chan_Dj add $dj 300"  if {![validuser $dj]}.................etc ....................................................</code></pre></div><span style="text-decoration:underline"><strong class="text-strong">PROC WHOIS ORIGINAL <a href="http://forum.egghelp.org/viewtopic.php?p=66160" class="postlink">http://forum.egghelp.org/viewtopic.php?p=66160</a> </strong></span>:<br><div class="codebox"><p>Code: </p><pre><code>bind join - * fooproc foo {n u h c} {  puthelp "whois $n"}bind raw - 311 gotraw ;# first WHOIS replybind raw - 307 gotraw ;# nick has identified (registered)bind raw - 318 gotraw ;# End of /WHOIS listproc gotraw {f k t} {  global whoised  set n [lindex [split $t] 1]  if {$k == "311"} {    set whoised($n) "0"  } elseif {$k == "307"} {    incr whoised($n)  } elseif {$k == "318"} {    if {$whoised($n) == "0"} {      puthelp "privmsg $n :please identify or register your nick U can register your nick with this (/msg NickServ REGISTER yourpassword youremail) without the ()."      puthelp "privmsg $n :Also you can use this to identify yourself if you already registered (/msg NickServ IDENTIFY yourpass) without the ()."    }  }}putlog "nickreg loaded"</code></pre></div><span style="text-decoration:underline"><strong class="text-strong">MY ATTEMPT TO UNITE BOTH PROCEDURES</strong></span>:<div class="codebox"><p>Code: </p><pre><code>proc add_fan {nick uhost hand chan text} {  global chan_radio whoisnick   if {$text == ""} {putmsg $chan "You must enter the nick of the fan to add!";return 0} set fan [join [lindex [split $text] 0]]set nickreg $fanputhelp "whois $nickreg"gotraw $nickreg  if {$whoisnick == 0 } { putmsg $chan "Can not add to staff a nick NO Signup!";return 0}  if {$whoisnick == 1 } {    putserv "PRIVMSG chan :access $chan_radio add $fan 100"  if {![validuser $fan]} {  adduser $fan  chattr $fan +c   putmsg $chan "You have added a $fan as fan radio"  } else {  if {![matchattr $fan +c]} {   chattr $fan +c   putmsg $chan "You have added a $fan as fan radio";return}  putmsg $chan "$fan was already a fan of the radio!"  }}}proc add_dj {nick uhost hand chan text} {  global chan_radio chan_Dj   if {$text == ""} {putmsg $chan "You must enter the nick of the dj to add!";return 0}  set dj [join [lindex [split $text] 0]]set nickreg $djputhelp "whois $nickreg"gotraw $nickreg  if {$whoisnick == 0 } { putmsg $chan "Can not add to staff a nick NO Signup!";return 0}  if {$whoisnick == 1 } {    putserv "PRIVMSG chan :access $chan_Dj add $dj 300"  if {![validuser $dj]}.................etc ....................................................}bind raw - 311 gotraw ;# first WHOIS replybind raw - 307 gotraw ;# nick has identified (registered)bind raw - 318 gotraw ;# End of /WHOIS listproc gotraw {f k t} {  global whoised whoisnick  set nickreg [lindex [split $t] 1]  if {$k == "311"} {    set whoised($nickreg) "0"  } elseif {$k == "307"} {    incr whoised($nickreg)  } elseif {$k == "318"} {    if {$whoised($nickreg) == "0"} {      set whoisnick 0    } else {      set whoisnick 1  }}putlog "nickreg loaded"</code></pre></div><br>I recognize that the line 'gotraw $nickreg' is wrong because no calls procedure gotraw properly, missing parameters.<br><br>I further acknowledge that the variable 'whoisnick' does not exist  because the procedure gotraw isnot call properly.<br><br>Someone can help me properly invoke the procedure 'gotraw' for purposes of the variable 'whoisnick' take appropriate values?<br><br>If you think of any other ideas will be welcome <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=12499">juanamores</a> — Sun Apr 05, 2015 11:02 pm</p><hr />
]]></content>
	</entry>
	</feed>
