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

	<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>2021-12-08T00:24:30-04:00</updated>

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

		<entry>
		<author><name><![CDATA[mondino]]></name></author>
		<updated>2021-12-08T00:24:30-04:00</updated>

		<published>2021-12-08T00:24:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110585#p110585</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110585#p110585"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110585#p110585"><![CDATA[
Thank you for your support, Spike^^<br><br>The script is working perfectly. It just had some Chars error while converting, which is easy to fix.<br><br>Thank you again.<br><br>Regards,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12749">mondino</a> — Wed Dec 08, 2021 12:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2021-12-07T12:31:23-04:00</updated>

		<published>2021-12-07T12:31:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110584#p110584</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110584#p110584"/>
		<title type="html"><![CDATA[formatfile2.tcl v0.3 by SpiKe^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110584#p110584"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>### Trivia Question File Format Converter 2 #### formatfile2.tcl v0.3 by SpiKe^^ (7Dec2021) #### Public command:  .format2  :will convert trivia files from...##   1. Question: What year did Disneyland open? #   Answer: 1955. ## ...to something more like:#   1955|What year did Disneyland open?### You can also specify a Question Category for the current file.# Public command:  .format2 Disney Trivia  :will convert to...# #   1955|Disney Trivia: What year did Disneyland open?# Script will also add a ? to the end of questions, if has none #### load this script to the eggdrop bot.### rename the source file to old.file &amp; put in scripts/ dir.### private message the bot with .format2 |or| .format2 Category-Namebind msg mno .format2 format:file2proc format:file2 {nick uhost hand arg} {  set oldfilename "scripts/old.file"  set newfilename "scripts/new.file"  if {![file exists $oldfilename]} {    putserv "PRIVMSG $nick :Error: File not found: $oldfilename"    return 0  }  set arg [string trim $arg]  if {$arg ne ""} {    if {![string match "*:" $arg]} {  append arg ":"  }    append arg " "  }  set openold [open $oldfilename r]  set opennew [open $newfilename w]  set cnt 0  set ques ""  ;  set answ ""  while {![eof $openold]} {    set line [string trim [gets $openold]]    if {$line eq ""} {  continue  }    if {$ques eq ""} {      if {![string match -nocase "answer: *" $line]} { set ques $line }      continue    }    if {[lsearch -nocase [lrange [split $line] 0 1] "question:"] &gt; -1} {      set ques $line  ;  continue    }    set answ $line    set x [lsearch -nocase [lrange [split $ques] 0 1] "question:"]    if {$x &gt; -1} {      regexp -nocase {question:(.*?)$} $ques - ques      set ques [string trim $ques]    }    if {[string tolower [lindex [split $answ] 0]] eq "answer:"} {      regexp -nocase {answer:(.*?)$} $answ - answ      set answ [string trim $answ ". "]    }    if {$ques ne "" &amp;&amp; $answ ne ""} {  incr cnt      if {![string match {*[.?]} $ques]} { append ques "?" }      puts $opennew "${answ}|${arg}$ques"    }    set ques ""  ;  set answ ""  }  close $openold  close $opennew  if {$cnt == 0} {  file delete $newfilename    putserv "PRIVMSG $nick :Error: No valid questions found in $oldfilename"  } else {    putserv "PRIVMSG $nick :Saved $cnt reformatted questions to $newfilename"  }  return 0}putlog "formatfile2.tcl ver 0.3 by SpiKe^^ Loaded."</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Dec 07, 2021 12:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mondino]]></name></author>
		<updated>2021-12-06T00:18:03-04:00</updated>

		<published>2021-12-06T00:18:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110574#p110574</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110574#p110574"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110574#p110574"><![CDATA[
Hi again.<br><br>That's getting challenging.<br><br>I need to convert this example: <br><br>1. Question: What year did Disneyland open?<br>Answer: 1955.<br><br>Into this:<br><br>ANSWER|Category-Name: Question?<br><br>Sometimes, the question is without numbering.<br><br>Thank you in advance.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12749">mondino</a> — Mon Dec 06, 2021 12:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mondino]]></name></author>
		<updated>2021-12-02T02:12:22-04:00</updated>

		<published>2021-12-02T02:12:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110572#p110572</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110572#p110572"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110572#p110572"><![CDATA[
Thank you again Spike^^<br><br>You have done a great job. The updated TCL script is working perfectly. It just added a "?" to the end of each question line. It did the job. <br><br>Thank you for your effort and quick reply.<br><br>Regards,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12749">mondino</a> — Thu Dec 02, 2021 2:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2021-12-01T14:19:10-04:00</updated>

		<published>2021-12-01T14:19:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110569#p110569</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110569#p110569"/>
		<title type="html"><![CDATA[formatfile.tcl v0.1 by SpiKe^^]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110569#p110569"><![CDATA[
Try this updated script...<div class="codebox"><p>Code: </p><pre><code>### Trivia Question File Format Converter ***# formatfile.tcl v0.1 by SpiKe^^ (1Dec2021) *# This script will convert trivia files from Q*A to A|Q ## Also convert Q*A1*A2*A3 to A1|Q (uses first answer) ## Also adds a ? to the end of questions, if has none ## Also removes any kaos and scramble questions ## load this script to the eggdrop bot.# rename the source file to old.file &amp; put in scripts/ dir.# private message the bot with .formatfilebind msg mno .formatfile format:fileproc format:file {nick uhost hand arg} {  set oldfilename "scripts/old.file"  set newfilename "scripts/new.file"  if {![file exists $oldfilename]} {    putserv "PRIVMSG $nick :Error: File not found: $oldfilename"    return 0  }  set openold [open $oldfilename r]  set opennew [open $newfilename w]  set cnt 0  while {![eof $openold]} {    lassign [split [gets $openold] "*"] ques answ    set ques [string trim $ques]    set answ [string trim $answ]    if {$ques eq "" || $answ eq ""} { continue }    if {[string match -nocase "kaos:*" $ques]} { continue }    if {[regexp -nocase {^(scramble|uword)$} $ques]} { continue }    if {![string match {*[.?]} $ques]} { append ques "?" }    incr cnt    puts $opennew "${answ}|$ques"  }  close $openold  close $opennew  if {$cnt == 0} {  file delete $newfilename    putserv "PRIVMSG $nick :Error: No valid questions found in $oldfilename"  } else {    putserv "PRIVMSG $nick :Saved $cnt reformatted questions to $newfilename"  }  return 0}putlog "formatfile.tcl ver 0.1 by SpiKe^^ Loaded."</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Wed Dec 01, 2021 2:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mondino]]></name></author>
		<updated>2021-12-01T01:11:19-04:00</updated>

		<published>2021-12-01T01:11:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110566#p110566</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110566#p110566"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110566#p110566"><![CDATA[
Thank you Spike^^ for the script. It works well.<br><br>I guess, we just need this script to be upgraded to add "?" to the end of each question line.<br><br>Note that, this tcl script doesn't work for "KAOS questions" type where the answer requires multiple words. It chose the first word after "*" as an answer which is not the case for KAOS type questions.<br><br>We might need to have a new tcl that would work for KAOS type questions in the future.<br><br>Thank you again, and I hope we work out to upgrade this TCL script to do the addition of "?" to the end of each question line.<br><br>Regards,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12749">mondino</a> — Wed Dec 01, 2021 1:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2021-11-30T11:50:05-04:00</updated>

		<published>2021-11-30T11:50:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110562#p110562</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110562#p110562"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110562#p110562"><![CDATA[
this script replies to the message command .formatfile from a user with the global userfile flag(s) m, n, and/or o<br><br>rename the original file to old.file<br>put that file in the eggdrop scripts/ dir<br>message the bot with .formatfile<br>the new file will be at scripts/new.file<br><div class="codebox"><p>Code: </p><pre><code>bind msg mno .formatfile format:fileproc format:file {nick uhost hand arg} {  set oldfilename "scripts/old.file"  set newfilename "scripts/new.file"  set openold [open $oldfilename r]  set opennew [open $newfilename w]  while {![eof $openold]} {    lassign [split [gets $openold] "*"] ques answ    if {$ques eq "" || $answ eq ""} { continue }    puts $opennew "${answ}|$ques"  }  close $openold  close $opennew}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Nov 30, 2021 11:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mondino]]></name></author>
		<updated>2021-11-30T03:07:51-04:00</updated>

		<published>2021-11-30T03:07:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110561#p110561</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110561#p110561"/>
		<title type="html"><![CDATA[Text Format Conversion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110561#p110561"><![CDATA[
Hello geeks.<br><br>I need a script to change the text format from:<br><br>Question*Answer  to Answer|Question?<br><br>Please note that, some lines have multiple "*", I'd want only the 1st word after "*" to be considered as "Answer" and be flipped to sit in the beginning of the line.<br><br>Briefly, I have a list of questions and answers that are written in the following format: Question*Answer and sometimes Question*Answer*Answer when a question requires more than an answer... that I need to change to this format: Answer|Question.<br><br>Thank you so much.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12749">mondino</a> — Tue Nov 30, 2021 3:07 am</p><hr />
]]></content>
	</entry>
	</feed>
