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

	<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>2004-10-24T09:49:05-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-10-24T09:49:05-04:00</updated>

		<published>2004-10-24T09:49:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42148#p42148</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42148#p42148"/>
		<title type="html"><![CDATA[Problems with the script Dictionary 4.68 by MORA@EFNet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42148#p42148"><![CDATA[
well, if the script's correctness is what bothers you, contacting the author is probably your best option; if you just need to get rid of that glitch, applying what I suggested is more than enough<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Oct 24, 2004 9:49 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Calamaro]]></name></author>
		<updated>2004-10-24T08:15:54-04:00</updated>

		<published>2004-10-24T08:15:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42146#p42146</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42146#p42146"/>
		<title type="html"><![CDATA[Problems with the script Dictionary 4.68 by MORA@EFNet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42146#p42146"><![CDATA[
Disregard my previous post. It would seem that the {} around words with special characters only comes when you remove a definition from the dictionary.<br><br>These are the relevant parts (i think):<div class="codebox"><p>Code: </p><pre><code>bind pub $dictionary(delflag) $dictionary(deltrigger) dic:pub:delproc dic:pub:del {nick uhost handle chan line} { global dictionary if {$dictionary(dicmchanonly)==1 &amp;&amp; [lsearch -exact [channel info $chan] +dicm]==-1} { return 0 } if {[dic:check:flood $handle]} { return 0 } if {[string range $line 0 0]=="\""} {  set found [join [lindex [split $line "\""] 1]]  set id [join [lindex [split $line "\""] 2]] } else {  set found [join [lindex $line 0]]  set id [join [lindex $line 1]] } #check if id is a integer. dic:del $found $id putlog "$nick@$chan $dictionary(deltrigger) $line" if {$dictionary(quiret) == 0 &amp;&amp; [dic:ishub $chan]} {  if {$dictionary(where)==1} { putserv "PRIVMSG $chan :Deleted $found \[$id\]" }  if {$dictionary(where)==2} { putserv "NOTICE $nick :Deleted $found \[$id\]" } }}proc dic:del {word id} { #Input : word and id, if id=0 delete all def for that word. #returns nothing global dictionary set dictionary(changed) 1 set word [join $word] set bgdb $dictionary(db) if {![info exists dictionary(db)]} { rehash ; return 0 } unset dictionary(db) set oid 0 foreach line $bgdb {  set line [split $line]  set found [lindex $line 2]  if {[string equal -nocase $found $word]} {   incr oid   if {$oid==$id || $id==0} { continue }  } #We should only get here if the word is not matched or it is not the number we want. lappend dictionary(db) $line }}</code></pre></div>Every time someone removes a definition from the db it adds another pair of {} around words with special characters.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5487">Calamaro</a> — Sun Oct 24, 2004 8:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Calamaro]]></name></author>
		<updated>2004-10-24T02:24:34-04:00</updated>

		<published>2004-10-24T02:24:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42131#p42131</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42131#p42131"/>
		<title type="html"><![CDATA[Problems with the script Dictionary 4.68 by MORA@EFNet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42131#p42131"><![CDATA[
Thanks for the reply but if i understand you correctly that seems more like a fix then a solution to the problem. This is the part of the script that adds the definitions to the in memory db:<div class="codebox"><p>Code: </p><pre><code>bind pub $dictionary(addflag) $dictionary(addtrigger) dic:pub:addproc dic:pub:add {nick uhost handle chan text} { global dictionary  if {$dictionary(dicmchanonly)==1 &amp;&amp; [lsearch -exact [channel info $chan] +dicm]==-1} { return 0 } if {[dic:check:flood $handle]} { return 0 } set str [dic:intr:add $text] set word [lindex $str 0] set def [lindex $str 1] if {$def==""} { putserv "PRIVMSG $chan :Error, no definition given." ; return 0 } dic:add $nick $word $def putlog "$nick@$chan $dictionary(addtrigger) $text" if {$dictionary(quiret) == 0 &amp;&amp; [dic:ishub $chan]} {  if {$dictionary(where)==1} { putserv "PRIVMSG $chan :Added $word=$def" }  if {$dictionary(where)==2} { putserv "NOTICE $nick :Added $word=$def" } }}proc dic:intr:add {line} { #input a string, as the user typed it. #output a list with 2 parts, word, def  if {[string range $line 0 0]=="\""} {   set found [join [lindex [split $line "\""] 1]]   set meaning [join [lrange [split $line "\""] 2 end]]  } else {   set found [lindex [split $line] 0]   set meaning [join [lrange [split $line] 1 end]]  }  lappend res $found  lappend res $meaning  return $res}proc dic:add {author word def} { #Both word and def are lists when we get em. global dictionary set dictionary(changed) 1 set word [split $word] if {[llength $word]&gt;1} { set word "\"[join $word]\"" } else { set word [join $word] } set def $def set time [strftime %m-%d-%Y@%H:%M] lappend dictionary(db) "$author $time $word $def"}</code></pre></div>And this writes it to the db file:<div class="codebox"><p>Code: </p><pre><code>bind time - "* * * * *" dic:save:listproc dic:save:list {m h d mm y} { global dictionary if {$dictionary(imtemphub) &gt; 0} { set dictionary(imtemphub) [expr $dictionary(imtemphub) - 1] } if {$dictionary(flood)&lt;$dictionary(floodlimit)} { set dictionary(flood) 0 } if {$dictionary(changed)==1} {  dicm:save:db:to:file $dictionary(file)  set dictionary(changed) 0 if {$dictionary(xml) == 1} {  set fp [open $dictionary(xmlname) w+]  puts $fp "&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\"?&gt;"  puts $fp "&lt;Dictionary&gt;"  foreach line $dictionary(db) {   puts $fp "&lt;entry&gt;"   puts $fp "&lt;author&gt;[join [lindex $line 0]]&lt;/author&gt;"   puts $fp "&lt;word&gt;[join [lindex $line 2]]&lt;/word&gt;"   puts $fp "&lt;time&gt;[join [lindex $line 1]]&lt;/time&gt;"   puts $fp "&lt;def&gt;[join [lrange $line 3 end]]&lt;/def&gt;"   puts $fp "&lt;/entry&gt;"  }  puts $fp "&lt;/Dictionary&gt;"  close $fp } }}proc dicm:save:db:to:file {file} {global dictionary  set fp [open $file w+]  foreach line $dictionary(db) { puts $fp [join [lrange [split $line] 0 end]] }  close $fp}</code></pre></div>Somewhere in these parts it's not handling special characters correctly. I will continue trying to find where. As always any help is appreciated.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5487">Calamaro</a> — Sun Oct 24, 2004 2:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2004-10-23T17:21:39-04:00</updated>

		<published>2004-10-23T17:21:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42116#p42116</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42116#p42116"/>
		<title type="html"><![CDATA[Problems with the script Dictionary 4.68 by MORA@EFNet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42116#p42116"><![CDATA[
I can't be bothered to d/l the script, but using [join] on the output will solve your problem:<div class="codebox"><p>Code: </p><pre><code>putserv "PRIVMSG $channel :[join $string_read_from_db]"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sat Oct 23, 2004 5:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Calamaro]]></name></author>
		<updated>2004-10-23T15:25:35-04:00</updated>

		<published>2004-10-23T15:25:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42114#p42114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42114#p42114"/>
		<title type="html"><![CDATA[Problems with the script Dictionary 4.68 by MORA@EFNet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42114#p42114"><![CDATA[
Here is the script <a href="http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&amp;id=839" class="postlink">http://www.egghelp.org/cgi-bin/tcl_arch ... oad&amp;id=839</a><br><br>The problem i'm having is that if i add a word and use special characters in the definition like:<div class="codebox"><p>Code: </p><pre><code>!learn Calamaro says "hell ya" alot</code></pre></div>It works correctly when i show the definition right away. But saves it like this to the db:<div class="codebox"><p>Code: </p><pre><code>Calamaro says {"hell ya"} alot</code></pre></div>So if/when i restart the bot it loads from the db and shows the definition with those {} around "hell ya" in the channel.<br><br>I've tried looking around in the script but this is a bit more then i can get through my head. Can anyone take a quick look or clue me in what to look for. I really like the script otherwise but this is kinda a showstopper since people do use special characters when adding definitions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5487">Calamaro</a> — Sat Oct 23, 2004 3:25 pm</p><hr />
]]></content>
	</entry>
	</feed>
