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

	<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>2011-05-21T16:08:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Pad]]></name></author>
		<updated>2011-05-20T18:35:08-04:00</updated>

		<published>2011-05-20T18:35:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96926#p96926</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96926#p96926"/>
		<title type="html"><![CDATA[mysqltcl: replace string [Solved]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96926#p96926"><![CDATA[
It worked too! Thank you very much! <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=11674">Pad</a> — Fri May 20, 2011 6:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2011-05-20T18:25:28-04:00</updated>

		<published>2011-05-20T18:25:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96925#p96925</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96925#p96925"/>
		<title type="html"><![CDATA[mysqltcl: replace string [Solved]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96925#p96925"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>mysqlmap $db_handle {id username post date} {  set post [string map [list "&lt;br&gt;" "\n"] $post]  foreach line [split $post "\n"] {    putserv "privmsg $chan :$line"  }}</code></pre></div>This will show you how to encapsulate and render newlines. Try this one too.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri May 20, 2011 6:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Pad]]></name></author>
		<updated>2011-05-20T18:21:51-04:00</updated>

		<published>2011-05-20T18:21:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96924#p96924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96924#p96924"/>
		<title type="html"><![CDATA[Re: mysqltcl: replace string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96924#p96924"><![CDATA[
It worked! Thank you! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>One more thing: is there any special character in IRC to make a newline like '\n' for PHP, C, etc?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11674">Pad</a> — Fri May 20, 2011 6:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2011-05-20T18:22:07-04:00</updated>

		<published>2011-05-20T18:03:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96923#p96923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96923#p96923"/>
		<title type="html"><![CDATA[Re: mysqltcl: replace string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96923#p96923"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>mysqlmap $db_handle {id username post date} {  set post [string map [list "&lt;br&gt;" " | "] $post]  putserv "privmsg $chan :$post"}</code></pre></div>You use the string map to convert, but are never storing those results as a variable. I included the "set post" and bracket encapsulation [ ] around the [string map] to properly build the correct sequence of commands (stacking). I've also used [list "replace-this" "with-this"] which will work properly regarding variables replacements and special characters (ie, un-exploitable via errors or otherwise), as <ul> <li>is the preferred way to do [string map] rather than hand-crafting within curly braces { }.<br><br>School is now in session. The bell has rang. Classroom is filling with students. Grab a seat while you can... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>/me takes a bite of the apple on his desk.<br><br>Having fun, is of tantamount importance as the task at hand. Remember this. Don't get angry, or give up when learning tcl. Have fun. Consider your failures as lessons, character building exercises. Not as some fundamental skill you lackl. Nobody is perfect. Having a laugh at stupid mistakes helps. Having fun while coding seriously is why I have a lot of success. For no other reason. I enjoy scripting for eggdrop. This  is what keeps me sane. This is my wooden ship in a bottle, that I slowly build meticulously piece by piece over time.</li></ul><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri May 20, 2011 6:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Pad]]></name></author>
		<updated>2011-05-21T16:08:42-04:00</updated>

		<published>2011-05-20T16:14:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96921#p96921</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96921#p96921"/>
		<title type="html"><![CDATA[mysqltcl: replace string [Solved]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96921#p96921"><![CDATA[
Hi. I have an Eggdrop connecting to a MySQL database using mysqltcl and displaying the info on an IRC channel. Some rows contain text that I don't want to display like &lt;br&gt; and I want to omit it.<br><br>I tried to use the "string map" function ( <a href="http://wiki.tcl.tk/2819" class="postlink">http://wiki.tcl.tk/2819</a> ) but the bot crashed when it read the &lt;br&gt; on string map {&lt;br&gt;  } $post. Then I tried to put only br to see if I was using it correctly but it seemed that the instruction was ignored.<br><br>I'm using this code to experiment:<br><div class="codebox"><p>Code: </p><pre><code>mysqlmap $db_handle {id username post date} {  string map {br |} $post  putserv "privmsg $chan :$post"}</code></pre></div>But it display the text normally. What am I doing wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11674">Pad</a> — Fri May 20, 2011 4:14 pm</p><hr />
]]></content>
	</entry>
	</feed>
