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

	<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>2001-10-14T01:08:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-14T01:08:00-04:00</updated>

		<published>2001-10-14T01:08:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=578#p578</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=578#p578"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=578#p578"><![CDATA[
damn it... after that all bot still says a text with {}<br>i'll go to sleep now and try to do something tomorrow...<br><br>{;)}<p>Statistics: Posted by Guest — Sun Oct 14, 2001 1:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-14T00:50:00-04:00</updated>

		<published>2001-10-14T00:50:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=577#p577</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=577#p577"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=577#p577"><![CDATA[
Taking your example and changing it around the the right format yeilds.<br><div class="codebox"><p>Code: </p><pre><code>proc pub_blabla {nick uhost hand chan strrr} {  set str [split $strrr]  lappend botarray $str...proc save_blabla {} {  set fff [open "some_file" w]  foreach n $botarray {    puts $fff " "[join $n]""  }</code></pre></div>There was some un-needed code in there, so  removed it.<br><blockquote class="uncited"><div>if { [lsearch $botarray [lindex $botarray $n]] &gt;= $n } {</div></blockquote>this is the equvilant of "Stab myself in heart to see if there is a knife in my heart.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Oct 14, 2001 12:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-14T00:34:00-04:00</updated>

		<published>2001-10-14T00:34:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=576#p576</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=576#p576"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=576#p576"><![CDATA[
no, not so easy, i'm idiot:)))<br>once again:<br><br>proc pub_blabla {nick uhost hand chan strrr} {<br>set str [split [lrange $strrr 0 end]]<br>lappend botarray $str<br>...<br>proc save_blabla {} {<br>set fff [open "some_file" w]<br>for {set n 0} {$n &lt; [llength $botarray]} {incr n} {<br>if { [lsearch $botarray [lindex $botarray $n]] &gt;= $n } {<br>puts $fff " "[lindex $botarray $n]""<br>}<br><br>please, show me in my code, where should i use JOIN<p>Statistics: Posted by Guest — Sun Oct 14, 2001 12:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-13T23:42:00-04:00</updated>

		<published>2001-10-13T23:42:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=574#p574</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=574#p574"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=574#p574"><![CDATA[
OK - here is a better example, with some output.<br><br>Here is a basic TCL session, that takes some punishment with some ; in it.<br><blockquote class="uncited"><div>% set h ""<br>% lappend h "heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">"<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">}<br>% lappend h ";)"<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {;)}<br>% lappend h test<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {;)} test<br>% lappend h test again<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {;)} test test again<br>% lappend h {and some more <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">}<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {;)} test test again {and some more <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">}<br>lappend h {j {;)}}<br>{heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {;)} tes test again {and some more <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">} {j {;)}}</div></blockquote>OK!<br><br>Now, to make make it spit each item in the list out<br><blockquote class="uncited"><div>% foreach a $h { puts stdout $a }<br>heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>test<br>test<br>again<br>and some more <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>j {;)}</div></blockquote>So lets do it the proper way<blockquote class="uncited"><div>% foreach a $h { puts stdout [join $a] }<br>heya peeps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>test<br>test<br>again<br>and some more <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>j <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"></div></blockquote><strong class="text-strong">NOTE:</strong> the use of "join" in the last outout, it made sure the {;)} became <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>&lt;font size=-1&gt;[ This Message was edited by: ppslim on 2001-10-13 21:44 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Oct 13, 2001 11:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-13T23:37:00-04:00</updated>

		<published>2001-10-13T23:37:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=573#p573</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=573#p573"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=573#p573"><![CDATA[
the thing is that bot adds user-text to list and then reads list and says random phrase.<br>so i need to get rid of these {} before it saves text to file <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by Guest — Sat Oct 13, 2001 11:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-13T23:33:00-04:00</updated>

		<published>2001-10-13T23:33:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=572#p572</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=572#p572"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=572#p572"><![CDATA[
Post the script here.<br><br>Yes, as stated in my previous post, the tcl will add the {}, coz it is suposed to, it could be dangerous not to.<br><br>{} = good<br>{} = good<br><br>So long as you join the text later, it will work fine.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Oct 13, 2001 11:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-13T23:27:00-04:00</updated>

		<published>2001-10-13T23:27:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=571#p571</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=571#p571"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=571#p571"><![CDATA[
ohhh.. tried to use:<br>lappend myarray [split $str]<br><br>it doesn't help, bot still adds {} to the text :/<br><br>dunno why, i did as you told...<p>Statistics: Posted by Guest — Sat Oct 13, 2001 11:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-13T22:55:00-04:00</updated>

		<published>2001-10-13T22:55:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=567#p567</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=567#p567"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=567#p567"><![CDATA[
Due to the way some chars work in TCL, they need to be corectly handled. {}[];$ are a few of these chars.<br><br>No regsub is required, just the corect useage of a few commands.<br><br>When taking input, use the split command. This will make sure that none of the text is interprited as a commands or anything else.<br><br>When writting it to file, use the join command, this will make sure it is written corectly.<br><br>EG, lets take a string of text from a channel, and put it into a a list (what you refer to as an array, is actualy a list).<div class="codebox"><p>Code: </p><pre><code>bind pubm - * test:procproc test:proc {nick uh hand chan arg} {  global mylist  lappend mylist "[split $arg]"}</code></pre></div>yes, this will mean that ; becomes {;}, but that doesn't matter, as it means the script is corectly storing things.<br><br>To write to file, we can now use<div class="codebox"><p>Code: </p><pre><code>proc writefile {} {  gloabl mylist  set fp [open "some.file" w]  foreach a $mylist {    puts $fp "[join $a]"  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Oct 13, 2001 10:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-13T22:35:00-04:00</updated>

		<published>2001-10-13T22:35:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=564#p564</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=564#p564"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=564#p564"><![CDATA[
#i thought it should help, now i think not<br>proc RegSubStr {str} {<br>  regsub -all {;} $str {;} outstr<br>  return $outstr<br>}<br>#adding text written by user to the array<br>lappend DumbBotArray [RegSubStr $str]<br>#saving it to file (with for ... $n)<br>puts $txtf " "[lindex $DumbBotArray $n]""<br>#or<br>puts $txtf " {[lindex $DumbBotArray $n]}"<br><br>suggestions?<br><br>&lt;font size=-1&gt;[ This Message was edited by: abn0rmal on 2001-10-13 20:48 ]&lt;/font&gt;<p>Statistics: Posted by Guest — Sat Oct 13, 2001 10:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2001-10-13T22:20:00-04:00</updated>

		<published>2001-10-13T22:20:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=562#p562</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=562#p562"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=562#p562"><![CDATA[
You aren't handling lists and strings properly. You should paste your script here so one of us can tell you where exactly the problem lies.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Sat Oct 13, 2001 10:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2001-10-13T22:18:00-04:00</updated>

		<published>2001-10-13T22:18:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=561#p561</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=561#p561"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=561#p561"><![CDATA[
Let it add it to the array like this. Use the "join" command when reading the array later.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Oct 13, 2001 10:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-13T21:57:00-04:00</updated>

		<published>2001-10-13T21:57:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=557#p557</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=557#p557"/>
		<title type="html"><![CDATA[problem with ;]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=557#p557"><![CDATA[
i'm writing a "talking script"...<br>the bot adds text, written by user to the array, and saves it with interval.<br>the problem is when user writes a text containing ` ; `, then bot adds {} to it<br>and i get {;)} instead of normal smile <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>i tried to regsub it ( ` ; ` to ` ; ` ), before adding to array, but it doesn't help and even makes the bot not to write that string to file..<br><br>what should i do?<p>Statistics: Posted by Guest — Sat Oct 13, 2001 9:57 pm</p><hr />
]]></content>
	</entry>
	</feed>
