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

	<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-06-20T13:52:47-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2008-06-20T13:52:47-04:00</updated>

		<published>2008-06-20T13:52:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83661#p83661</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83661#p83661"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83661#p83661"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>The problem is probably with your text file.</div></blockquote>me: !whatever "Test"<br>bot: says whatever to Test<br><br>me: !whatever Test"<br>bot: says whatever to Test"<br><br>I see it works if you use " " two rather than one, was hoping to strip on the accidental typo of one " that always gets me by the enter key lol</div></blockquote>The script outputs a line from a text file when you type !whatever and the same if you type "!whatever test ...." the arguments you add after !whatever are never displayed in the output text (at least using the script I've written above). So if you have a modified version of the script, please paste it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri Jun 20, 2008 1:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2008-06-20T09:04:12-04:00</updated>

		<published>2008-06-20T09:04:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83656#p83656</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83656#p83656"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83656#p83656"><![CDATA[
Thanks <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=7220">cache</a> — Fri Jun 20, 2008 9:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-06-20T00:05:28-04:00</updated>

		<published>2008-06-20T00:05:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83652#p83652</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83652#p83652"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83652#p83652"><![CDATA[
<blockquote class="uncited"><div>&lt;speechles&gt; .tcl set a "\"hello\""<br>&lt;sp33chy&gt; Tcl: "hello"<br>&lt;speechles&gt; .tcl set b [join $a]<br>&lt;sp33chy&gt; Tcl: hello<br>&lt;speechles&gt; .tcl set c $a<br>&lt;sp33chy&gt; Tcl: "hello"</div></blockquote>As I said above, [join] can help eradicate visibility of escapes, but the consequence is that it also removes other things (if they aren't over-escaped), such as double-quotes as evidenced above...<blockquote class="uncited"><div>&lt;speechles&gt; .tcl set a "\\\"hello\\\""<br>&lt;sp33chy&gt; Tcl: \"hello\"<br>&lt;speechles&gt; .tcl set b [join $a]<br>&lt;sp33chy&gt; Tcl: "hello"<br>&lt;speechles&gt; .tcl set c [join [join $a]]<br>&lt;sp33chy&gt; Tcl: hello</div></blockquote><span style="font-size:84%;line-height:116%">basically, tclsh on the partyline.. enabling .tcl and .set allows combined usage and is nice.</span><br><br>If it's simply over-escaped text, as you can see above, [join] removes the visible escape and keeps intact the double-quotes. It is usually better to find the source of the over-escaping (which most times is simply the result of using [split] or "tcl special character" filters (which simulate [split] escape behavior) when it isn't required) and correcting it before attempting to repair the damage done after the fact. But for a quick fix, it's fine, and this is exactly why you should be using [join] to solve it.<br><br>Note: Your subject line '!cmd pulled from txt file with timers' indicates use of timers. Timers usually involve setting parameters to <ul> <li>elements and this has the same escape behavior as using [split] does. If you mean timer as in throttling a users use of commands (by checking elapsed time) then this has nothing really to do with timers, ignore this note. In both cases, [join] is the answer.<div class="codebox"><p>Code: </p><pre><code>puthelp "privmsg $chan :[join [subst -nocommands $sexmsg]]" </code></pre></div><blockquote class="uncited"><div>&lt;speechles&gt; .tcl set a [join [subst -nocommands "hello $::botnick {"]]<br>&lt;sp33chy&gt; Tcl error: unmatched open brace in list<br>&lt;speechles&gt; .tcl set a [join [subst -nocommands "hello $::botnick{"]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy{</div></blockquote>Unmatched open braces with spaces before them will crash this instantly. Afterall, we just want [join]s escape removing powers activated. [join] will see any unescaped curly bracings with leading spaces as list element fields and attempt to match and join them too, we don't want that.<div class="codebox"><p>Code: </p><pre><code>puthelp "privmsg $chan :[join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands $sexmsg]]]"</code></pre></div><blockquote class="uncited"><div>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands "hello $::botnick {"]]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy {<br>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands "hello $::botnick{"]]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy{<br>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands "hello $::botnick"]]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy</div></blockquote>This should work all combined, the string map will over-escape curly bracings if found (to stop [join] from trying to match list elements), then the [join] will remove all those over-escaped escapes, including the escapes on the curly bracings. The above is the code you should use...<br><br>...But to further everyone's knowledge, let's test those double-quotes.<blockquote class="uncited"><div>&lt;speechles&gt; .tcl set b "\""<br>&lt;sp33chy&gt; Tcl: "<br>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands "hello $::botnick $::b"]]]<br>&lt;sp33chy&gt; Tcl error: unmatched open quote in list<br>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" } [subst -nocommands "hello $::botnick$::b"]]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy"<br>&lt;speechles&gt; .tcl set a [join [string map { " \{" " \\\{" " \{" " \\\}" " \"" " \\\"" } [subst -nocommands "hello $::botnick { $::b"]]]<br>&lt;sp33chy&gt; Tcl: hello sp33chy { "</div></blockquote>Now we've got it, over-escaping any double-quotes with leading spaces as well should do it. In your case this should already be happening as witnessed by yourself and is the entire reason for this excercise. The below code is only to be useful to those reading this for some learning experience.<div class="codebox"><p>Code: </p><pre><code>puthelp "privmsg $chan :[join [string map { " \{" " \\\{" " \{" " \\\}" " \"" " \\\"" } [subst -nocommands $sexmsg]]]"</code></pre></div>And even still, this code is not perfect (certain combinations of special characters will cause tcl errors and will need placement into the string map escape sequences, this will happen often and unpredictably). It can never be entirely safe. It can only temporarily fix a bad situation and make it a little better. The best solution is finding where the escapes are being generated and put a stop to it there rather than attempt to fix it with additional code.</li></ul><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Jun 20, 2008 12:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2008-06-19T19:40:50-04:00</updated>

		<published>2008-06-19T19:40:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83649#p83649</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83649#p83649"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83649#p83649"><![CDATA[
<blockquote class="uncited"><div>The problem is probably with your text file.</div></blockquote>me: !whatever "Test"<br>bot: says whatever to Test<br><br>me: !whatever Test"<br>bot: says whatever to Test"<br><br>I see it works if you use " " two rather than one, was hoping to strip on the accidental typo of one " that always gets me by the enter key lol<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Thu Jun 19, 2008 7:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-06-19T15:21:23-04:00</updated>

		<published>2008-06-19T15:21:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83646#p83646</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83646#p83646"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83646#p83646"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> set sexmsg [join [randomline $sex]]</code></pre></div>joining the line should eliminate the escape sequences, but might introduce other errors along the way.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Thu Jun 19, 2008 3:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2008-06-19T11:54:38-04:00</updated>

		<published>2008-06-19T11:54:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83642#p83642</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83642#p83642"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83642#p83642"><![CDATA[
The problem is probably with your text file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Jun 19, 2008 11:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2008-06-17T11:56:29-04:00</updated>

		<published>2008-06-17T11:56:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=83588#p83588</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=83588#p83588"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=83588#p83588"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>set sex "../data/whatever.txt"set usedcmd [expr {[unixtime]-60}]bind pub - !whatever cmdproc cmd {nick uhost hand chan arg} { global usedcmd sex if {[set t [expr {[unixtime]-$usedcmd}]] &lt; 60} {  puthelp "privmsg $chan :You have to wait [expr {60-$t}] sec(s) before you can use this command."  return 0 } set usedcmd [unixtime] set sexmsg [randomline $sex] puthelp "privmsg $chan :[subst -nocommands $sexmsg]"}proc randomline f { set data [split [read [set file [open $f]]][close $file] \n] set position [rand [llength $data]] lindex $data $position}</code></pre></div></div></blockquote>I like this script, anyway it can be changed to work with !whatever "text"? The " character displays as &lt;Bot&gt; does whatever to "text" adding those \ thingys.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Tue Jun 17, 2008 11:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2006-04-24T19:28:38-04:00</updated>

		<published>2006-04-24T19:28:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62300#p62300</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62300#p62300"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62300#p62300"><![CDATA[
Thanks that worked  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Mon Apr 24, 2006 7:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-04-24T18:25:06-04:00</updated>

		<published>2006-04-24T18:25:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62298#p62298</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62298#p62298"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62298#p62298"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set sex "../data/whatever.txt"set usedcmd [expr {[unixtime]-60}]bind pub - !whatever cmdproc cmd {nick uhost hand chan arg} { global usedcmd sex if {[set t [expr {[unixtime]-$usedcmd}]] &lt; 60} {  puthelp "privmsg $chan :You have to wait [expr {60-$t}] sec(s) before you can use this command."  return 0 } set usedcmd [unixtime] set sexmsg [randomline $sex] puthelp "privmsg $chan :[subst -nocommands $sexmsg]"}proc randomline f { set data [split [read [set file [open $f]]][close $file] \n] set position [rand [llength $data]] lindex $data $position}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Apr 24, 2006 6:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2006-04-24T17:33:45-04:00</updated>

		<published>2006-04-24T17:33:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62294#p62294</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62294#p62294"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62294#p62294"><![CDATA[
I gave this a try but I didn't get any errors  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br><div class="codebox"><p>Code: </p><pre><code>#######set sex "../data/whatever.txt" set usedcmd [unixtime] bind pub - !whatever cmdproc cmd {nick uhost hand chan arg} {  global usedcmd  global sex if {[unixtime]-$usedcmd &lt; 60} {return 0}  set usedcmd [unixtime]  set sexmsg [string range [randomline $sex] 0 end]  puthelp "privmsg $chan :[subst -nocommands $sexmsg]"}proc randomline f {  set data [split [read [set file [open $f]]][close $file] \n]  set position [rand [llength $data]]  lindex $data $position }###########</code></pre></div>Any idea what im doing wrong?<br><br>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Mon Apr 24, 2006 5:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-04-24T16:33:01-04:00</updated>

		<published>2006-04-24T16:33:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62293#p62293</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62293#p62293"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62293#p62293"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set usedcmd [unixtime]bind pub - !cmd cmdproc cmd {nick uhost hand chan arg} { global usedcmd if {[unixtime]-$usedcmd &lt; 60} {return 0} set usedcmd [unixtime] # do your stuff here.}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Apr 24, 2006 4:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2006-04-24T16:14:06-04:00</updated>

		<published>2006-04-24T16:14:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62291#p62291</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62291#p62291"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62291#p62291"><![CDATA[
The way im looking at the script. it just stops that one person from re-using it right? Cause im trying to disable it for everyone at the same time till 60 secs is up...<br><br>Still trying to figure out how to combine the two scripts lol<br><br>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Mon Apr 24, 2006 4:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-04-23T18:16:14-04:00</updated>

		<published>2006-04-23T18:16:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62275#p62275</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62275#p62275"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62275#p62275"><![CDATA[
Yeah, that's why I linked to the 2nd topic. I've implemented the cmd in 20 seconds there (you can change it to 60).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Apr 23, 2006 6:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cache]]></name></author>
		<updated>2006-04-23T15:41:14-04:00</updated>

		<published>2006-04-23T15:41:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62270#p62270</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62270#p62270"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62270#p62270"><![CDATA[
Hi Sir,<br><br>I read those before posting but im trying to see if I can make it where you can only type !cmd once every 60secs instead of every 5 secs etc. Like if 60 secs wasn't up it would PM chatter and say 'Wait 60secs before reusing this cmd.'<br><br>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7220">cache</a> — Sun Apr 23, 2006 3:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-04-23T04:45:03-04:00</updated>

		<published>2006-04-23T04:45:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=62252#p62252</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=62252#p62252"/>
		<title type="html"><![CDATA[!cmd pulled from txt file with timers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=62252#p62252"><![CDATA[
See <a href="http://forum.egghelp.org/viewtopic.php?t=11721" class="postlink">this</a> and <a href="http://forum.egghelp.org/viewtopic.php?t=11697" class="postlink">this</a> (at the bottom).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Apr 23, 2006 4:45 am</p><hr />
]]></content>
	</entry>
	</feed>
