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

	<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>2007-10-24T07:42:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-24T07:42:07-04:00</updated>

		<published>2007-10-24T07:42:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77058#p77058</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77058#p77058"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77058#p77058"><![CDATA[
Hi there,<br><br>Thanks for the details. Yes, "$temp" is not in the code provided but it is in the script.<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Wed Oct 24, 2007 7:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-23T10:29:11-04:00</updated>

		<published>2007-10-23T10:29:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77036#p77036</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77036#p77036"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77036#p77036"><![CDATA[
To be honest, I can't even find the variable "temp" within the piece of code you've posted...<br><br>Generally, quotes should not cause problems with neither lists or strings..<br>Of course, this code will fail, but due to incorrect structures...<div class="codebox"><p>Code: </p><pre><code>set myvar "Testing "in string"</code></pre></div>Problem here is that the first parameter is terminated at the second ", but is directly followed by additional characters. Either you've forgotten to escape the ", or you accidentally grouped two parameters (forgot a space). Tcl can't figure out which, and barks.<br>Correct code in the above example:<div class="codebox"><p>Code: </p><pre><code>set myvar "Testing \"in string"set myvar {Testing "in string}</code></pre></div>Now, using myvar with any command that expects a string as parameter (where $myvar is used on the commandline) will work perfectly.<br>Ofcourse, $myvar should <strong class="text-strong">NOT</strong> be used with any command that expects a list, since it is a string.<br><br>A list would be created as such:<div class="codebox"><p>Code: </p><pre><code>#Make {Testing "in string} a single list-element:set myvar [list "Testing \"in string"]set myvar [list {Testing "in string}]#Make Testing "in string separate list elements:set myvar [list Testing \"in string]set myvar [list Testing {"in} string]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Oct 23, 2007 10:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-23T07:13:39-04:00</updated>

		<published>2007-10-23T07:13:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77033#p77033</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77033#p77033"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77033#p77033"><![CDATA[
Hi there,<br><br>Thanks for the info. Yes, I didn't add split to all "lindex". To be accurate, I add them to "lindex" that need to process the "$arg" and all variable that related to that. I guess I need to rephrase my question regarding the quote. If there is quote in the variable call "temp", will it cause error to script?<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Tue Oct 23, 2007 7:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-22T10:48:50-04:00</updated>

		<published>2007-10-22T10:48:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77011#p77011</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77011#p77011"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77011#p77011"><![CDATA[
First off, don't use split just because you use lindex. Only use split if you need to convert a string into a list. That is, keep track of wether the data is a list or a string. Using split on lists may result in undesired results aswell.<br><br>"" is used as bounds of data that should be preprocessed, doing variable, command, and escape-evaluations. Any " within such data-block must be escaped.<br><br>A perhaps better description might be found <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm" class="postlink">here</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Oct 22, 2007 10:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-22T10:04:25-04:00</updated>

		<published>2007-10-22T10:04:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=77006#p77006</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=77006#p77006"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=77006#p77006"><![CDATA[
Hi there,<br><br>Thanks for the reply. I have added split to most "lindex". After going through the third time. I notice I miss out one split on one of the lindex. I added it and it seem to be running smooth now. It still need more testing though. Now I got another question, will quote cause error to script?<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Mon Oct 22, 2007 10:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-21T10:47:24-04:00</updated>

		<published>2007-10-21T10:47:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76942#p76942</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76942#p76942"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76942#p76942"><![CDATA[
If you get errors such as that, it usually means you are mixing lists and strings. Although split does fix these issues at some times (especially when you use list commands on strings), it's really important to understand <span style="text-decoration:underline">why</span> you should use split in certain situations.<br><br>Simply put tho, commands such as lindex, lrange, lreplace, foreach, join and many others (check their respective manpages) operate on lists, and might break on strings.<br><br>Commands such as "string" are generally not list-safe, that is, if used on a list it might damage the list-structure, rendering it unusable as list (causing lindex, etc to break)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Oct 21, 2007 10:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-21T08:31:39-04:00</updated>

		<published>2007-10-21T08:31:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76937#p76937</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76937#p76937"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76937#p76937"><![CDATA[
Hi there,<br><br>I read through some stuff and it seem split is able to fix the problem. I have add it into the script and see if it fix it.<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Sun Oct 21, 2007 8:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-21T01:39:00-04:00</updated>

		<published>2007-10-21T01:39:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76929#p76929</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76929#p76929"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76929#p76929"><![CDATA[
Hi there,<br><br>Thanks for offering your help. I have found yet another bug in the script. Since the relay script uses socket to connect to another IRC network. All data is in its RAW form. I notice a problem in PRIVMSG raw where when there is braces "{ or }", the script will end up in error. I tried using regular expression to remove the "{ or }", it don't seem to works. Any suggestion in doing this? All RAW data is in this variable call "$arg".<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Sun Oct 21, 2007 1:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sKy]]></name></author>
		<updated>2007-10-20T16:41:38-04:00</updated>

		<published>2007-10-20T16:41:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76920#p76920</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76920#p76920"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76920#p76920"><![CDATA[
May you tell me what problem you want to solve with that script (relay what?)?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6101">sKy</a> — Sat Oct 20, 2007 4:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-20T15:16:56-04:00</updated>

		<published>2007-10-20T15:16:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76917#p76917</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76917#p76917"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76917#p76917"><![CDATA[
Hi there,<br><br>Thank you for your advice. I have decided to go with check of "repeat_count($iphost)" and assume if it exist then there will be timer exist as well. It will be more efficient in performance compare with the loop check in timer. So far, there isn't any problem running it. Once again, Thanks.<br><br>Regard,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Sat Oct 20, 2007 3:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-19T17:00:19-04:00</updated>

		<published>2007-10-19T17:00:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76890#p76890</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76890#p76890"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76890#p76890"><![CDATA[
I guess an ugly check would be to simply use "string first" or "string match", and skip the foreach loop. Not sure how much performace you'd gain however.<br><br>One thing that might improve it slightly, is to replace your "string match" with "string equal", since the latter does a character-by-character comparison, and does'nt care 'bout wildcard matching.<br><br>Another ugly hack might be to assume there is a timer already running, if "repeat_count($iphost)" already exists upon entering the proc, as a previous invocation would've started the timer if repeat_count($iphost) had been set, and if the timer had completed, repeat_count($iphost) would've been unset.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Oct 19, 2007 5:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-19T16:44:59-04:00</updated>

		<published>2007-10-19T16:44:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76889#p76889</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76889#p76889"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76889#p76889"><![CDATA[
Hi there,<br><br>Thank you for the advice, it is indeed the timers that been created without control that is causing the problem. I did a check on the timer to make sure it don't exist before creating them. However, is there a better way to do this timer check as it is slow to loop through the timers as I did them.<br><div class="codebox"><p>Code: </p><pre><code>proc repeatCheck {iphost} { # Access and Store GLOBAL global repeat repeat_count # Check for existence, add if it didn't exist if {![info exists repeat_count($iphost)]} {  lappend repeat_count($iphost) 0 } # Increase count and set timer to remove it incr repeat_count($iphost) foreach utimer [utimers] {  if {[string match "unset repeat_count($iphost)" [lindex $utimer 1] ]} {   set timerCheck 1  } } if {![info exists timerCheck]} {  utimer [lindex $repeat 1] "unset repeat_count($iphost)" } else {  unset timerCheck } # Do what when reach the maximum repeat if {$repeat_count($iphost) &gt; [lindex $repeat 0]} {  return 1 } return 0}</code></pre></div>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Fri Oct 19, 2007 4:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-19T13:32:52-04:00</updated>

		<published>2007-10-19T13:32:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76879#p76879</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76879#p76879"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76879#p76879"><![CDATA[
Hi there,<br><br>Thanks for the reply. I notice another problem, if a user repeat 5 lines within 1 or 2s. The check won't be fast enough to consider them as repeat. I will look into the variable you mention.<br><br>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Fri Oct 19, 2007 1:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-10-19T13:27:55-04:00</updated>

		<published>2007-10-19T13:27:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76878#p76878</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76878#p76878"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76878#p76878"><![CDATA[
Possibly use separate variables, rather than multiple variables in a list (repeat).<br><br>There is a conditon in your script that might cause multiple timers to unset the same array index. Although having pending timers does'nt take processing-time in itself, the unset command would be called numerous times, blocking other executions.<br><br>Could the queue-system (with throttling) be an issue?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Oct 19, 2007 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Lu5ck]]></name></author>
		<updated>2007-10-19T10:39:46-04:00</updated>

		<published>2007-10-19T10:39:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76875#p76875</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76875#p76875"/>
		<title type="html"><![CDATA[Relay Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76875#p76875"><![CDATA[
Hi all,<br><br>I did a repeat spam in it, however, it is unable to process fast enough for the huge amount of data flowing through it. How can I further improve the repeat system, I am currently using timer for it.<br><div class="codebox"><p>Code: </p><pre><code>proc repeatCheck {iphost} { # Access and Store GLOBAL global repeat repeat_count # Check for existence, add if it didn't exist if {![info exists repeat_count($iphost)] &amp;&amp; [lsearch -exact $repeat 0] == -1} {  set repeat_count($iphost) 0 } # Increase count and set timer to remove it incr repeat_count($iphost) 1 utimer [lindex $repeat 1] [list unset -nocomplain repeat_count($iphost)] # Do what when reach the maximum repeat if {$repeat_count($iphost) == [lindex $repeat 0]} {  return 1 } return 0}</code></pre></div>Regards,<br>Lu5ck<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8476">Lu5ck</a> — Fri Oct 19, 2007 10:39 am</p><hr />
]]></content>
	</entry>
	</feed>
