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

	<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-08-18T21:24:35-04:00</updated>

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

		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2012-08-18T21:24:35-04:00</updated>

		<published>2012-08-18T21:24:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99904#p99904</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99904#p99904"/>
		<title type="html"><![CDATA[Re: mass slap+say script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99904#p99904"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> if {[llength [lindex $args 0]]&lt;2} {# becomes to the eggdrop every single timeif {1 &lt; 2 } {</code></pre></div>Here is your problem. "[llength [lindex $args 0]]" will always be 1. It has no choice but to be because of how you've used it in your procedure declaration.<br><br>Stop using "[lindex $args 0]" all over the place. Everywhere you have that change it to "[split $arg]".<br><br>Also, change this part:<br>proc msg_say {nick uhost hand args} { <br><br>to this:<br>proc msg_say {nick uhost hand arg} { <br><br>There are more errors than this in your script concerning list to string errors. But I will let you figure those out. Only in certain conditions with certain characters should you notice the bugs.<br><blockquote class="uncited"><div>A point worthy of note about args<br>Putting args as the last argument of a Tcl procedure allows the use of a variable number of input arguments. But there is a potential source of confusion if the procedure is one that is called by an eggdrop bind command.<br><br>In a script that I downloaded I saw code similar to the following:<br><br>bind dcc - m2f dcc_calc_m2f<br>proc dcc_calc_m2f {hand idx args} {<br>  if {[llength $args] == "1"} {<br><br>The author was no doubt thinking that if a user typed<br>.m2f aaa bbb ccc<br>then the value of args would be a list of three elements, aaa, bbb and ccc, and that therefore the value of [llength $args] would be 3.<br><br>In fact, the value of args would be a list of one element, that element being the string aaa bbb ccc. Whatever string the user types, the value of [llength $args] will always be 1.<br><br>Similarly, the value of [lindex $args 0] will not be the string aaa, but the string aaa bbb ccc.<br><br>The eggdrop pub and msg binds behave in the same way.<br><br>The above properties of eggdrop's bind command have been confirmed by testing with eggdrop version 1.6.6.</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Aug 18, 2012 9:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Atako]]></name></author>
		<updated>2012-08-18T14:54:03-04:00</updated>

		<published>2012-08-18T14:54:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99903#p99903</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99903#p99903"/>
		<title type="html"><![CDATA[mass slap+say script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99903#p99903"><![CDATA[
Hey! Could you help me?<br><br>I need a script mass slap+say<br><br>I will write on one channel: .say blebleble<br><br>and bot will slap all users on #channel and say blebleble Can someone help me?<br><br>I've say and mass slap script but i can't <div class="codebox"><p>Code: </p><pre><code>bind msg - .say msg_sayproc msg_say {nick uhost hand args} {    global botnick     if {[llength [lindex $args 0]]&lt;2} {        putserv "NOTICE $nick :/msg $botnick .say #chan_name &lt;text&gt;"    } else {        set chan [lindex [lindex $args 0] 0]        if { ![validchan $chan]} {            putserv "NOTICE $nick :\"$chan\": invalid chan."            return 0        }        ## FIX ME this condition is never reached        if { ![onchan $botnick $chan] } {            putserv "NOTICE $nick :je ne suis pas sur le chan \"$chan\"."            return 0        }        ## END FIX ME        # comment this next 4 lines if you want to be able to talk in a chan you're not in        if { ![onchan $nick $chan] } {            putserv "NOTICE $nick :tu n'es pas sur le chan \"$chan\"."            return 0        }        set msg [lrange [lindex $args 0] 1 end]    }    proc massslap {nick uhost hand chan text args} {    # dump only 25 nicks per line    set chanList [chanlist $chan]    while {[llength $chanList] != 0} {       puthelp "PRIVMSG $chan :[join [lrange $chanList 0 25]]"       set chanList [lrange $chanList 25 end]    } }     putchan $chan $msg}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12061">Atako</a> — Sat Aug 18, 2012 2:54 pm</p><hr />
]]></content>
	</entry>
	</feed>
