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

	<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-02-11T06:05:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[tezoost]]></name></author>
		<updated>2015-02-11T06:05:07-04:00</updated>

		<published>2015-02-11T06:05:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103474#p103474</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103474#p103474"/>
		<title type="html"><![CDATA[list element followed by &quot;XYZ&quot; instead of space]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103474#p103474"><![CDATA[
This will show a multi line traceback to the last error. If you read this you will know what you have to do to prevent this error. <br>The ugly point is, errorInfo shows always the last error. So, if you use catch and a error has been caused it will show that error last, so be fast Wink.<br><br><br><br><br>_____________________________________________<br>Usman<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12488">tezoost</a> — Wed Feb 11, 2015 6:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CoolCold]]></name></author>
		<updated>2003-03-03T21:37:05-04:00</updated>

		<published>2003-03-03T21:37:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17378#p17378</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17378#p17378"/>
		<title type="html"><![CDATA[using {} [] etc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17378#p17378"><![CDATA[
I think that arguments substitution is one of TCL's features and  the same time one of biggest security holes - using {} or [] inproperly,programmer lets intruder to make script work the other way it should...so this short example by stdagon is very impotant I think.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2774">CoolCold</a> — Mon Mar 03, 2003 9:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-09-15T17:33:03-04:00</updated>

		<published>2002-09-15T17:33:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10940#p10940</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10940#p10940"/>
		<title type="html"><![CDATA[list element followed by &quot;XYZ&quot; instead of space]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10940#p10940"><![CDATA[
This common error is caused by improper use of <a href="http://www.tcl.tk/man/tcl8.3/Keywords/L.htm#list" class="postlink">list operations</a> on strings. The most common list operations used in this manner are lindex and lrange. Many scripts will use these commands to extract words from a string. For instance:<br><div class="codebox"><p>Code: </p><pre><code>bind pub o|o !kick pub_kickproc pub_kick {nick uhost hand chan arg} {  # Person to kick is first arg  set target [lindex $arg 0]  # Kick message is remaining words  set kickmsg [lrange $arg 1 end]  ...}</code></pre></div>However, if you try to kick someone with a strange nick like {hello}kitty, you will soon encounter an error: list element in braces followed by "kitty" instead of space<br><br>So, how do you solve this problem? A lot of scripts use an ugly hack (regsub) to add slashes into the string. That is the wrong way. Tcl provides a command called <a href="http://www.tcl.tk/man/tcl8.3/TclCmd/split.htm" class="postlink">split</a> that splits a string into a proper list. Each word in the string becomes an element in the list.<br><br><strong class="text-strong">Therefore the quick fix for this error is to replace $arg with [split $arg] whenever lindex or lrange is used.</strong><br><br>For instance, the above script can be fixed like this:<br><div class="codebox"><p>Code: </p><pre><code>bind pub o|o !kick pub_kickproc pub_kick {nick uhost hand chan arg} {  # Person to kick is first arg  set target [lindex [split $arg] 0]  # Kick message is remaining words  set kickmsg [lrange [split $arg] 1 end]  ...}</code></pre></div>Now it will work properly with any nick.<br><br>If you need more explanation, please post questions below. <em class="text-italics">Not currently possible</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Sun Sep 15, 2002 5:33 pm</p><hr />
]]></content>
	</entry>
	</feed>
