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

	<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>2019-01-27T13:54:38-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2019-01-27T13:54:38-04:00</updated>

		<published>2019-01-27T13:54:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107375#p107375</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107375#p107375"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107375#p107375"><![CDATA[
As i was looking on the forums for something I stumbled onto a very old discussion (<a href="http://forum.egghelp.org/viewtopic.php?t=6690" class="postlink">this</a>) where user and strikelight (two forum users, long time idle sadly) debated over a pice of code user made to wrap some text output. Here is the final code with the changes they discussed:<div class="codebox"><p>Code: </p><pre><code>proc wordwrap {str {len 70} {splitChr { }}} {set out [set cur {}]; set i 0foreach word [split [set str][set str ""] $splitChr] {if {[incr i [string len $word]]&gt;$len} {lappend out [join $cur $splitChr]set cur [list $word]set i [string len $word]} else {lappend cur $word}incr i}   lappend out [join $cur $splitChr]}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Jan 27, 2019 1:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2019-01-24T08:59:41-04:00</updated>

		<published>2019-01-24T08:59:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107370#p107370</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107370#p107370"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107370#p107370"><![CDATA[
Yes its from a trivia script i wrote from scratch.<br><br>I was thinking of something to add the letters after the split, but never got it working.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Thu Jan 24, 2019 8:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2019-01-24T03:40:22-04:00</updated>

		<published>2019-01-24T03:40:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107369#p107369</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107369#p107369"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107369#p107369"><![CDATA[
Basically the line you are mentioned is most likely from a trivia bot and is "obfuscated" by adding a character between words and a special color so that regular legit users can see the question without the extra colored characters, but anyone else why tries to be cheeky or copy/paste the question would have a hard time "decoding" it back to a normal question.<br><br>If you own the bot (based on your claim that you can start/stop the "obfuscation" process) that is spitting the trivia questions why do you need this? What exactly do you want to achieve here? Want to cheat at your own game? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><br><br>Since the "special" character used to "obfuscate" the code (in the given example is "m") is also found in the other words used in the question reversing the process is kind off an impossible task, unless you know exactly at what positions it was added. For example an extra 'm' is added at 2, 5, 8, and so on. So if you know the pattern then is easy to replace the special character with a space and then recreate the question into a "word word word" that with the code I mentioned would get the result you wanted.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Thu Jan 24, 2019 3:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2019-01-23T15:05:30-04:00</updated>

		<published>2019-01-23T15:05:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107368#p107368</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107368#p107368"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107368#p107368"><![CDATA[
heartbroken: Works only if i stop the antihack part. So when the questions is "word word word" works, but when its in a single word it brocks.<br><br>Anyone with an idea on how to make anything split using the antihack option?<br><br>Antihack = it adds a random letter each question between the spaces of the words, so if you try to copy - paste the question it would be "impossible" to read.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Wed Jan 23, 2019 3:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2019-01-23T14:42:45-04:00</updated>

		<published>2019-01-23T14:42:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107366#p107366</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107366#p107366"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107366#p107366"><![CDATA[
It looks that way because of the ANTI HACK part.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Wed Jan 23, 2019 2:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heartbroken]]></name></author>
		<updated>2019-01-22T12:16:51-04:00</updated>

		<published>2019-01-22T12:16:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107355#p107355</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107355#p107355"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107355#p107355"><![CDATA[
tcllib/textutil could be an alternative: <a href="https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/textutil/textutil_split.html" class="postlink">https://core.tcl.tk/tcllib/doc/trunk/em ... split.html</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11703">heartbroken</a> — Tue Jan 22, 2019 12:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2019-01-22T01:34:12-04:00</updated>

		<published>2019-01-22T01:34:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107350#p107350</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107350#p107350"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107350#p107350"><![CDATA[
That script tries to split the text in a correct place, at the nearest space.<br><br>The string you try is long, but has no spaces.<br><br>That is not a valid string, there is no single "word" that long:)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Jan 22, 2019 1:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2019-01-21T13:10:02-04:00</updated>

		<published>2019-01-21T13:10:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107348#p107348</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107348#p107348"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107348#p107348"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc Trivia247:wraptext {chan text characters} {   set len [string length $text] putlog $len    while {$len} {       if {$len &gt; $characters} {          set cut [string range $text 0 [expr $characters - 1]]          set output [string range $cut 0 [string last " " $cut]]          set text [string range $text [string length $output] end]          incr len -$characters       } else {          set output [string range $text 0 $len]          set len 0       }putlog "$output"putlog "[string length $output]"      putserv "PRIVMSG $chan :$output"   } }</code></pre></div><br>DCC CHAT:<br><blockquote class="uncited"><div>[18:09:03] 1499<br>[18:09:03] BONUS +14:  <br>[18:09:03] 44<br><br>[18:09:03] 0<br><br>[18:09:03] 0<br>[18:09:03] InmcemanmamavutmlocmprimamparticiparemamRomanieimlamunmturneumfinalmalmCampionatuluimMondialInmc<br>[18:09:03] 300</div></blockquote>Channel:<blockquote class="uncited"><div>&lt;Androo&gt; BONUS +14:  <br>&lt;Androo&gt; InmcemanmamavutmlocmprimamparticiparemamRomanieimlamunmturneumfinalmalmCampionatuluimMondialInmc<br>&lt;Androo&gt;  1st Hint:  ***   +12  Bonus<br>&lt;Androo&gt;  2nd Hint:  d**   +10  Bonus<br>&lt;Androo&gt;  3rd Hint:  *aa   +8  Bonus</div></blockquote>Don`t why... from your example it should work.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Mon Jan 21, 2019 1:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2019-01-20T14:36:08-04:00</updated>

		<published>2019-01-20T14:36:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107346#p107346</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107346#p107346"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107346#p107346"><![CDATA[
In PHP there's a function called wordwrap that dose this nicely. Here's how I got about the same results in TCL.<div class="codebox"><p>Code: </p><pre><code>proc wordwrap {text max} {set len [string length $text]while {$len} {if {$len &gt; $max} {set cut [string range $text 0 [expr $max - 1]]set output [string range $cut 0 [string last " " $cut]]set text [string range $text [string length $output] end]incr len -$max} else {set output [string range $text 0 $len]set len 0}puts "output: $output"}}</code></pre></div>results:<div class="codebox"><p>Code: </p><pre><code>% set text "Evening, can anyone help me with a code that will split the text in two lines (getting all the text in does 2 lines) if its bigger than a max length ? Thanks"Evening, can anyone help me with a code that will split the text in two lines (getting all the text in does 2 lines) if its bigger than a max length ? Thanks% wordwrap $text 80output: Evening, can anyone help me with a code that will split the text in two linesoutput: (getting all the text in does 2 lines) if its bigger than a max length ? Thank% wordwrap $text 50output: Evening, can anyone help me with a code that willoutput: split the text in two lines (getting all the textoutput: in does 2 lines) if its bigger than a max lengthoutput: ? Thanks% wordwrap $text 100output: Evening, can anyone help me with a code that will split the text in two lines (getting all the textoutput: in does 2 lines) if its bigger than a max length ? Thanks</code></pre></div>Notice that it doesn't break words so it looks nicely.<br><br>PS: The code at the end of the <a href="http://forum.egghelp.org/viewtopic.php?t=20564" class="postlink">Character hiding and showing</a> topic isn't working or completly forgot about that topic? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><br><br>PS #2: On Rosetta Code there's <a href="https://www.rosettacode.org/wiki/Word_wrap#Tcl" class="postlink">wrapParagraph</a> with another approach on this.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Jan 20, 2019 2:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2019-01-20T11:36:57-04:00</updated>

		<published>2019-01-20T11:36:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107345#p107345</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107345#p107345"/>
		<title type="html"><![CDATA[Spliting text in two lines]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107345#p107345"><![CDATA[
Evening, can anyone help me with a code that will split the text in two lines (getting all the text in does 2 lines) if its bigger than a max length ? Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Sun Jan 20, 2019 11:36 am</p><hr />
]]></content>
	</entry>
	</feed>
