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

	<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>2008-09-02T22:24:30-04:00</updated>

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

		<entry>
		<author><name><![CDATA[psychic]]></name></author>
		<updated>2008-09-02T22:24:30-04:00</updated>

		<published>2008-09-02T22:24:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85032#p85032</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85032#p85032"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85032#p85032"><![CDATA[
Thanks all, I got it all working and much better now. Thanks to the guys on IRCNet #Eggdrop!<br><br>Thanks all!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10185">psychic</a> — Tue Sep 02, 2008 10:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-09-02T19:44:14-04:00</updated>

		<published>2008-09-02T19:44:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85031#p85031</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85031#p85031"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85031#p85031"><![CDATA[
Messing up lists and strings is indeed a problem within this script, but it will not cause the error mentioned in the original post. Regardless of the type of data, it's still one single parameter, so putlog would not complain 'bout number of parameters.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Sep 02, 2008 7:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-09-02T19:44:51-04:00</updated>

		<published>2008-09-02T19:40:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85030#p85030</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85030#p85030"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85030#p85030"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set passed_data [lrange [lindex $args 0] 0 end]putlog $passed_data</code></pre></div>There is your error. You use lrange incorrectly, and passed_data becomes a list. When you try to putlog this list, it causes dilemma. Using <em class="text-italics">putlog "$passed_data"</em> with double quotes encapsulating the list variable is a way to fix it. You can also try a <em class="text-italics">putlog [join $passed_data]</em>, but it doesn't corrected the flawed list/string relationships. You will see curly braces denoting list fields. Perhaps consider the lessons learned from nml375 concerning lists vs strings and vice versa.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Tue Sep 02, 2008 7:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-09-02T14:27:31-04:00</updated>

		<published>2008-09-02T14:27:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85027#p85027</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85027#p85027"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85027#p85027"><![CDATA[
Syntax for newchanban seems pretty much ok:<br>"newchanban &lt;channel&gt; &lt;ban&gt; &lt;creator&gt; &lt;comment&gt; ?lifetime? ?options?"<br><br>So, assuming arg2, arg3, and arg4 has been properly set, that part should work like a charm.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Sep 02, 2008 2:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psychic]]></name></author>
		<updated>2008-09-02T14:11:50-04:00</updated>

		<published>2008-09-02T14:11:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85026#p85026</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85026#p85026"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85026#p85026"><![CDATA[
Alright, but can we focus a bit on the "newchanban" thingy? Can you tell me a correct syntax of using newchanban here? I mean in my code. ( I did change $args to a different name too)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10185">psychic</a> — Tue Sep 02, 2008 2:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-09-02T14:03:24-04:00</updated>

		<published>2008-09-02T14:03:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85025#p85025</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85025#p85025"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85025#p85025"><![CDATA[
Still, none of those putlogs are responsible for that error of yours.. That error is elsewhere in your script.<br><br>=====<br><br>A quick rule of thumb, do not use the name "args" for any argument name in your procs. This is a special name, which has some extended features and caveats. Unless you are an advanced coder, you will have no use for those features, and the caveats are such that you need that [lindex $args 0] whenever you try to process the last argument.<br><br>Next, there are two fundamentally different data types in tcl. These are strings, and lists. Only use list-commands such as lindex, lrange, etc. on lists, never strings. If you need to "convert" a string into a list, use the command <strong class="text-strong">split</strong>. At the same time, don't use lists when a command expects a string.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Sep 02, 2008 2:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psychic]]></name></author>
		<updated>2008-09-02T13:53:41-04:00</updated>

		<published>2008-09-02T13:53:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85024#p85024</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85024#p85024"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85024#p85024"><![CDATA[
I am afraid this didn't really help me much, I still can't do it.<br>All I wish to do is something like if { $cmd == "addban"} { newchanban $arg2 (host) $arg4 (duration in days) $arg3 (ban message) }<div class="codebox"><p>Code: </p><pre><code>bind msg -|m command syntcmdproc syntcmd {nick uhost hand args} {global botnick set cmdchan "#test"set passed_data [lrange [lindex $args 0] 0 end]set arg1 [lindex [lindex $args 0] 0]set cmd  [lindex [lindex $args 0] 0] set arg2 [lindex [lindex $args 0] 1]set arg3 [lindex [lindex $args 0] 2]set arg4 [lindex [lindex $args 0] 3]set the_msg [lrange [lindex $args 0] 2 end]set isgood 0if { $cmd == "addban"} {set isgood 1    newchanban $thechan $arg2 $nick $arg4 $arg3}putlog "blah_blah: command was: $cmd issued by: $nick directed toward: $arg2"if { $isgood == "0"} {putlog "WARNING from docmd: bad command processing for - "putlog $passed_data return 0}}</code></pre></div>Make more sense now?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10185">psychic</a> — Tue Sep 02, 2008 1:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-09-02T13:06:30-04:00</updated>

		<published>2008-09-02T13:06:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85021#p85021</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85021#p85021"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85021#p85021"><![CDATA[
That error is not related to the posted code. Look for some part of your script that contains putlog, as this is where the error most likely is located.<br><br>A few notes on the code in question however;<br>I see no reason for the use of the special argument "args". Especially since you only retrieve the first argument (lindex $args 0). Considder using something different, such as text.<br>Secondly, your use of lrange, as well as further use of lindex is flawed, as the "list" actually is a string. Please considder using <strong class="text-strong">split</strong> to convert the string to a list prior any list operations..<br><br>I will post a partial example on how you should use list commands, and how to implement the proc with normal arguments, rather than using the special "args".<br><div class="codebox"><p>Code: </p><pre><code>...proc command {nick host hand text} { set tlist [split $text] set cmd [lindex $tlist 0] ...}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Sep 02, 2008 1:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[psychic]]></name></author>
		<updated>2008-09-02T11:10:59-04:00</updated>

		<published>2008-09-02T11:10:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85019#p85019</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85019#p85019"/>
		<title type="html"><![CDATA[newchanban issue]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85019#p85019"><![CDATA[
This is a part of my tcl which is not working and I get this error <span style="color:red">wrong # args: should be "putlog text"</span><div class="codebox"><p>Code: </p><pre><code>Here's the requested code from the pastebin:Wrap Lines   Use Line Numbersbind msg -|fpm command commandproc command {nick uhost hand args} { global botnick  set thechan "#chan" set passed_data [lrange [lindex $args 0] 0 end] set arg1 [lindex [lindex $args 0] 0] set cmd  [lindex [lindex $args 0] 0]  set arg2 [lindex [lindex $args 0] 1] set arg3 [lindex [lindex $args 0] 2] set arg4 [lindex [lindex $args 0] 3] if { $cmd == "addban"} {    newchanban $thechan $arg2 $nick $arg4 $arg3 }</code></pre></div>/msg botnickname command addban &lt;host&gt; &lt;ban time in days or any format&gt; &lt;ban reason&gt;<br>to set add a ban to the bots banlist (like .+ban .....)<br><br>Could somebody help me please correct my syntax?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10185">psychic</a> — Tue Sep 02, 2008 11:10 am</p><hr />
]]></content>
	</entry>
	</feed>
