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

	<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>2008-04-14T14:48:54-04:00</updated>

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

		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-14T03:15:20-04:00</updated>

		<published>2008-04-14T03:15:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82301#p82301</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82301#p82301"/>
		<title type="html"><![CDATA[thanks, one more questions...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82301#p82301"><![CDATA[
thanks speechles<br><br>i'll create a new thread if i need more help. i worked out the following via trial and error:<blockquote class="uncited"><div><br>where abouts do i check the text for errors before it gets the things from the site? after<div class="codebox"><p>Code: </p><pre><code># if bible isn't set for the channel, return and do nothing    if {[lsearch -exact [channel info $chan] +bible] == -1} {return} </code></pre></div>?<br><br>and do i use the var $text to check on correct spellings and to allow for shortcuts like 'cor' for corinthians?<br><br>like <div class="codebox"><p>Code: </p><pre><code> if {[lindex [split $text] 0] == "help"} {biblehelp} </code></pre></div> to check if someone asked for help, then goto a proc biblehelp and return -- not sure how to do this yet, but i'll keep looking!<br><br>thanks</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Mon Apr 14, 2008 3:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-04-13T22:39:31-04:00</updated>

		<published>2008-04-13T22:39:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82299#p82299</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82299#p82299"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82299#p82299"><![CDATA[
<blockquote class="uncited"><div>&lt;speechles&gt; !bible mark 4:1-9<br>&lt;sp33chy&gt; Mark 4:1-9 (Today's New International Version)<br>&lt;sp33chy&gt; Mark 4. The Parable of the Sower.<br>&lt;sp33chy&gt; 1) Again Jesus began to teach by the lake. The crowd that gathered around him was so large that he got into a boat and sat in it out on the lake, while all the people were along the shore at the water's edge.<br>&lt;sp33chy&gt; 2) He taught them many things by parables, and in his teaching said:<br>&lt;sp33chy&gt; 3) "Listen! A farmer went out to sow his seed.<br>&lt;sp33chy&gt; 4) As he was scattering the seed, some fell along the path, and the birds came and ate it up.<br>&lt;sp33chy&gt; 5) Some fell on rocky places, where it did not have much soil. It sprang up quickly, because the soil was shallow.<br>&lt;sp33chy&gt; 6) But when the sun came up, the plants were scorched, and they withered because they had no root.<br>&lt;sp33chy&gt; 7) Other seed fell among thorns, which grew up and choked the plants, so that they did not bear grain.<br>&lt;sp33chy&gt; 8<strong class="text-strong"></strong>) Still other seed fell on good soil. It came up, grew and produced a crop, some multiplying thirty, some sixty, some a hundred times."<br>&lt;sp33chy&gt; 9) Then Jesus said, "Whoever has ears to hear, let them hear."<br><br>&lt;speechles&gt; !bible genesis 4:12 <br>&lt;sp33chy&gt; Genesis 4:12 (Today's New International Version)<br>&lt;sp33chy&gt; 12) When you work the ground, it will no longer yield its crops for you. You will be a restless wanderer on the earth."</div></blockquote><div class="codebox"><p>Code: </p><pre><code># BibleGateway Example using EggHttp via speechless# freeware - feel free to use any part of this script for any purpose.# To enable this script requires one of 2 methods below:# 1) some chans: on dcc partyline, type: .chanset #yourchan +bible# 2) all bot chans: on dcc partyline, type .chanset * +bible# NOTE: Code is purposely over commented to explain each section.# Configset pubtrigger "!bible"set pubspeed 5# End of config# script begins with egghttp checkif {![info exists egghttp(version)]} {  putlog "egghttp.tcl was NOT successfully loaded."  putlog "biblegateway.tcl has not been loaded as a result."} else {  proc biblegateway {sock} {    global url    global chan2    set headers [egghttp:headers $sock]    set body [egghttp:data $sock]    # remove all newlines, carriage returns, tabs, and vertical tabs    regsub -all {(?:\n|\r|\t|\v)} $body "" body    # grab the title and if success, change   into space    # if fails, set title accordingly    if {[regexp {&lt;h3&gt;(.+?)&lt;/h3&gt;} $body - title]} {      # change   into space      regsub -all { } $title " " title    } else {      # if no title is found we must set one      set title "No Title"    }       # grab the subtitle and other relevant subtitles    # gather them into a single line.    if {[regexp {&lt;p&gt;&lt;h.*?&gt;(.+?)&lt;span id} $body - moretitle]} {      # these end each subtitle, changing them to . allows      # them to fit on one line, in a sort-of sentence.      regsub -all {&lt;/h.&gt;} $moretitle ". " moretitle      # replace non-breaking space tags with true spaces.      regsub -all { } $moretitle " " moretitle      # remove all remaining html tags.      regsub -all {&lt;.*?&gt;} $moretitle "" moretitle    } else {      # some valid pages have no subtitles      # so if none is found, we will just set it blank.      set moretitle ""    }        # message title and subtitles.    putserv "privmsg $chan2 :$title"    putserv "privmsg $chan2 :$moretitle"    # reset pubspeed counter    set count 0    # while we have text, let's recurse the loop    while {[regexp -- {&lt;span id.*?"&gt;(.+?)&lt;span} $body - line]} {      # increment pubspeed counter      incr count      # remove from the $body the regexp leader      # so that the same exact segment can never      # match twice.      regsub -- {&lt;span id.*?"&gt;} $body "" body      # each verse number is encased within span tags      # changing the end tag to a parenthesis cleans up text      regsub -all {&lt;/span&gt;} $line "\)" line      # this combination should be dealt with first      regsub -all {\[&lt;.*?&gt;\]} $line "" line      # now remove the rest of the html tags      regsub -all {&lt;.*?&gt;} $line "" line      # this non-breaking space is for web display      # irrelevant on irc, let's remove it      regsub -all { } $line "" line      # pubspeed check, if exceeded puthelp      if {$count &gt; $::pubspeed} {        puthelp "privmsg $chan2 :$line"      } else {        putserv "privmsg $chan2 :$line"      }    }  }  # bind pub  bind pub -|- $::pubtrigger our:pubtrigger  # channel flag  setudef flag bible  proc our:pubtrigger {nick uhand hand chan text} {    global url    global chan2    set chan2 $chan    # if bible isn't set for the channel, return and do nothing    if {[lsearch -exact [channel info $chan] +bible] == -1} {return}    # set the url using urlencode function based on $text    set url "http://www.biblegateway.com/passage/?search=[our:urlencode $text]&amp;version=72"    # call bible    set sock [egghttp:geturl $url biblegateway]  }  # convert text into html approved % codes.  proc our:urlencode {text} {    set aurl ""    foreach byte [split [encoding convertto utf-8 $text] ""] {      scan $byte %c i      if {$i &lt; 65 || $i &gt; 122} {        append aurl [format %%%02X $i]      } else {        append aurl $byte      }    }    return [string map {%3A : %2D - %2E . %30 0 %31 1 %32 2 %33 3 %34 4 %35 5 %36 6 %37 7 %38 8 %39 9 \[ %5B \\ %5C \] %5D \^ %5E \_ %5F \` %60} $aurl]  }  putlog "biblegateway.tcl has been successfully loaded."}</code></pre></div>Tested &amp; works, doing the lords work.. haw.. pubspeed is the amount of lines which will be putserved, the rest will be puthelped. If you find the bot getting excess flooded off IRC, lower it. If you find the bot is too slow to display everything, raise it.<br><br>You will now need to develop some kind of flood protection as well as some kind of error detection mechanism, other than that here you go, enjoy.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>Note: inline regexp with a foreach would've been nice to use, but it isn't possible with how the page is built. The while loop is the way to do it in this case.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Apr 13, 2008 10:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T15:06:25-04:00</updated>

		<published>2008-04-13T15:06:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82297#p82297</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82297#p82297"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82297#p82297"><![CDATA[
um, ok, perhaps something else is preventing thing from happening.<br>here's from the console after i give the command:<blockquote class="uncited"><div>[21:05] [@] frommn!~<a href="mailto:ninda@SF-609D90B5.cybersmart.co.za">ninda@SF-609D90B5.cybersmart.co.za</a> PRIVMSG #questions :!example genesis 4:12<br>[21:05] WARNING: open_telnet_raw() is about to block in gethostbyname()!<br>[21:05] net: connect! sock 27<br>[21:05] net: eof!(read) socket 27</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 3:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-04-14T00:33:55-04:00</updated>

		<published>2008-04-13T11:20:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82294#p82294</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82294#p82294"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82294#p82294"><![CDATA[
see my very last post, the most relevant. the code here was buggy and useless. same can be said of the entire text of this post, heh.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Apr 13, 2008 11:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T09:56:13-04:00</updated>

		<published>2008-04-13T09:56:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82292#p82292</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82292#p82292"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82292#p82292"><![CDATA[
ok, couldnt resist...<br>got this error when i said !example mark 1:1<blockquote class="uncited"><div>[15:57] Tcl error [our:pubtrigger]: variable "chan" already exists</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 9:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T09:51:49-04:00</updated>

		<published>2008-04-13T09:51:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82291#p82291</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82291#p82291"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82291#p82291"><![CDATA[
ok, i opened netbeans and got a new script file. pasted the code and played with it until the else { had his partner } at the bottom. not sure what i did, but i got to this:<div class="codebox"><p>Code: </p><pre><code># Configset pubtrigger "!example"# End of configif {![info exists egghttp(version)]} {  putlog "egghttp.tcl was NOT successfully loaded."  putlog "biblegateway.tcl has not been loaded as a result."} else {  proc biblegateway {sock} {    global url    global chan    set headers [egghttp:headers $sock]    set body [egghttp:data $sock]    # remove all newlines, carriage returns, tabs, and vertical tabs    regsub -all {(?:\n|\r|\t|\v)} $body "" body     # grab the title and if success, change   into space    # if fails, set title accordingly    if {[regexp {&lt;h3&gt;(.+?)&lt;/h3&gt;} $body - title]} {      # change   into space      regsub -all { } $title " " title    } else {      # if no title is found we must set one      set title "No Title"    }       # grab the subtitle and other relevant subtitles    # gather them into a single line.    if {[regexp {&lt;p&gt;&lt;h.*&gt;(.+?)&lt;span id} $body - moretitle]} {      # change closing header tag to a period to better      # compact all the subtitles into one line and keep      # it looking pretty.      regsub -all {&lt;/h.*&gt;} $moretitle ". " moretitle      regsub -all { } $title " " title      # remove all remaining html tags.      regsub -all {&lt;.*&gt;} $moretitle "" moretitle    } else {      # some valid pages have no subtitles      # so if none is found, we will just set it blank.      set moretitle ""    }    # pull the verses from the page in list format    # which allows using a foreach to step through it.    regexp -all -inline {&lt;span id.*"&gt;(.+?)&lt;/p&gt;} $body - text     # at this point, you can figure it out more than likely...    # $title is your main title    # $moretitle is the subtitles    # $text is the body of each verse in list format    putserv "privmsg $chan :$title"    # eggdrop will not message a blank line    # so this line may not be messaged.    putserv "privmsg $chan :$moretitle"    # roll thru the list    foreach line $text {      putserv "privmsg $chan :$line"    }  }  # bind pub  bind pub -|- $::pubtrigger our:pubtrigger  # channel flag  setudef flag bible  proc our:pubtrigger {nick uhand hand chan text} {    global url    global chan    # if bible isn't set for the channel, return and do nothing    if {[lsearch -exact [channel info $chan] +bible] == -1} {return}    # set the url using urlencode function based on $text    set url "http://www.biblegateway.com/passage/?search=[urlencode $text]&amp;version=72"    # call bible    set sock [egghttp:geturl $url biblegateway]  }  # convert text into html approved % codes.  proc urlencode {text} {    set aurl ""    foreach byte [split [encoding convertto utf-8 $text] ""] {      scan $byte %c i      if {$i &lt; 65 || $i &gt; 122} {        append aurl [format %%%02X $i]      } else {        append aurl $byte      }    }    return [string map {%3A : %2D - %2E . %30 0 %31 1 %32 2 %33 3 %34 4 %35 5 %36 6 %37 7 %38 8 %39 9 \[ %5B \\ %5C \] %5D \^ %5E \_ %5F \` %60} $aurl]  }  putlog "biblegateway.tcl has been successfully loaded."} </code></pre></div>i .rehash and didnt crash the bot. i'm gonna go have tea and maybe leave home after that..dont know when i can test it.<br><br>wish i could have a running commentary when i was playing with the code. i dont think i have learnt anything... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>until then, bye?!?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 9:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T09:27:47-04:00</updated>

		<published>2008-04-13T09:27:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82289#p82289</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82289#p82289"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82289#p82289"><![CDATA[
ok, that didnt work, trying something else: see comment of 'try 1' and 'try 2'<div class="codebox"><p>Code: </p><pre><code> # pull the verses from the page in list format    # which allows using a foreach to step through it.    # i removed The '} {' from the end of the line --FAILED and put back - try 1 unsuccessful    regexp -all -inline {&lt;span id.*"&gt;(.+?)&lt;/p&gt;} $body - text]} {    # at this point, you can figure it out more than likely...    # $title is your main title</code></pre></div><div class="codebox"><p>Code: </p><pre><code># grab the subtitle and other relevant subtitles    # gather them into a single line.    # removed a '}' end of moretitle} -- try 2    if {[regexp {&lt;p&gt;&lt;h.*&gt;(.+?)&lt;span id} $body - moretitle} {      # change closing header tag to a period to better      # compact all the subtitles into one line and keep      # it looking pretty.</code></pre></div>[/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 9:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T08:49:16-04:00</updated>

		<published>2008-04-13T08:49:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82288#p82288</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82288#p82288"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82288#p82288"><![CDATA[
um, ok. i .rehash and then it crashed, so i checked the logs and this is what it sed:<br>[14:15] egghttp.tcl API v1.1.0 by strikelight now loaded.<br>[14:15] Tcl error in file 'statsbot.conf':<br>[14:15] wrong # args: extra words after "else" clause in "if" command<br>while executing<br>"if {![info exists egghttp(version)]} {<br>putlog "egghttp.tcl was NOT successfully loaded."<br>putlog "biblegateway.tcl has not been loaded as a result...."<br>(file "scripts/biblegateway.tcl" line 5)<br>invoked from within<br>"source scripts/biblegateway.tcl"<br>(file "statsbot.conf" line 1369)<br>[14:15] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)<br><br>i dont know tcl, so i'm confused! dont know how to fix it...<br>HeLP<br><br>is it possibly the curly braces at the end?:<div class="codebox"><p>Code: </p><pre><code># pull the verses from the page in list format    # which allows using a foreach to step through it.    regexp -all -inline {&lt;span id.*"&gt;(.+?)&lt;/p&gt;} $body - text]} {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 8:49 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-13T07:45:52-04:00</updated>

		<published>2008-04-13T07:45:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82287#p82287</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82287#p82287"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82287#p82287"><![CDATA[
wow,<br>thanks strikelight and speechles!!<br><br>to let you know, i have no clue how regexp an all works. my only experience with programming is with turbopascal 7 from school and html and a little php.<br>that &lt;p/&gt; was actually coppied out of the website - i was a little confused as to why it was not &lt;/p&gt;.<br><br>i'll most definately use it for inspiration.<br><br>thanks again to both of you<br>SMiLE<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sun Apr 13, 2008 7:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-04-13T23:58:10-04:00</updated>

		<published>2008-04-13T03:33:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82283#p82283</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82283#p82283"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82283#p82283"><![CDATA[
@malcsman, try using this snippet for inspiration. Uses .chanset #yourchan +bible.. have a fun. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><div class="codebox"><p>Code: </p><pre><code>see code snippet in my last post below.</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Apr 13, 2008 3:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-04-13T02:39:11-04:00</updated>

		<published>2008-04-13T02:39:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82282#p82282</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82282#p82282"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82282#p82282"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>    set boddy "example"     regsub -all "\n" $body "" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;p&gt;} $body " " body    regsub -all -nocase {&lt;span id="en-TNIV-24335" class="sup"&gt;} $body "\002" body    regsub -all -nocase {&lt;/span&gt;} $body "\002" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;/p&gt;} $body " " body    regexp {&lt;div class="result-text-style-normal"&gt;(.*?)&lt;p/&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;} $body - boddy </code></pre></div>This will never work, the regexp won't ever see a p (not to mention he uses incorrect tagging <strong class="text-strong">p/</strong>). He's regsubbing them into spaces before that regexp ever gets to see $body, therefore it will fail, the contents of $boddy will not be overwritten, $boddy will remain "example" (and in the case of previously undefined variables, the variable will not even get created if the regexp fails). His output of course when he runs his example will be just that and is just that. He stated so in his plea for assistance.<br><span style="font-size:84%;line-height:116%"> I know you know this strikelight, I was just mentioning it for his benefit. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"></span></div></blockquote>Ya, have to admit, i missed it... didn't pay close enough attention i guess  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Apr 13, 2008 2:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-04-13T01:28:57-04:00</updated>

		<published>2008-04-13T01:28:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82281#p82281</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82281#p82281"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82281#p82281"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>    set boddy "example"     regsub -all "\n" $body "" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;p&gt;} $body " " body    regsub -all -nocase {&lt;span id=\"en-TNIV-24335\" class=\"sup\"&gt;} $body "\002" body    regsub -all -nocase {&lt;/span&gt;} $body "\002" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;/p&gt;} $body " " body    regexp {&lt;div class="result-text-style-normal"&gt;(.*?)&lt;p/&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;} $body - boddy </code></pre></div>This will never work, the regexp won't ever see a p (not to mention he uses incorrect tagging <strong class="text-strong">p/</strong>). He's regsubbing them into spaces before that regexp ever gets to see $body, therefore it will fail, the contents of $boddy will not be overwritten, $boddy will remain "example" (and in the case of previously undefined variables, the variable will not even get created if the regexp fails). His output of course when he runs his example will be just that and is just that. He stated so in his plea for assistance.<br><span style="font-size:84%;line-height:116%"> I know you know this strikelight, I was just mentioning it for his benefit. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"></span><br><br>@malcsman: The reason you see others use regsub before their regexp's is so that any html tokens not needed for parsing are removed prior to parsing. In this way minor website changes shouldn't cause a hassle for the script if it merely involes any of those removed html tokens. To have your regexp's parse things perfectly may not be possible if you remove too many html tokens (they will fail and won't carry over variable associations). So the general rule of thumb is, only try to regsub out html tokens you perceive as clutter (cruft), not those you can possibly use to base regexp's around.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Apr 13, 2008 1:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-04-12T22:55:38-04:00</updated>

		<published>2008-04-12T22:55:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82280#p82280</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82280#p82280"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82280#p82280"><![CDATA[
You've already removed \n's with your regsub...<br>Your regexp already gets the portion of the text that you want... so searching for those tokens in your loop is pointless.<br><br>What is the output you get when you run your example?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sat Apr 12, 2008 10:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[malcsman]]></name></author>
		<updated>2008-04-14T14:48:54-04:00</updated>

		<published>2008-04-12T17:27:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82279#p82279</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82279#p82279"/>
		<title type="html"><![CDATA[[SOLVED]help using egghttp from egghttp_example.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82279#p82279"><![CDATA[
hello<br><br>Iḿ really confused as to how this all works. if someone could please help me.<br>all i want is to show the bible verses.<br><br>if i echo the $body, then i get an output. if i use any other var, nothing comes out..or it comes out as ¨example¨<br><br>here´s my code:<div class="codebox"><p>Code: </p><pre><code># egghttp_example.tcl# Configset url "http://www.biblegateway.com/passage/?search=mark%204:1-9&amp;version=72"set dcctrigger "example"# End of configif {![info exists egghttp(version)]} {  putlog "egghttp.tcl was NOT successfully loaded."  putlog "biblegateway.tcl has not been loaded as a result."} else {  proc biblegateway {sock} {    global url    set headers [egghttp:headers $sock]    set body [egghttp:data $sock]    set boddy "example"    regsub -all "\n" $body "" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;p&gt;} $body " " body    regsub -all -nocase {&lt;span id=\"en-TNIV-24335\" class=\"sup\"&gt;} $body "\002" body    regsub -all -nocase {&lt;/span&gt;} $body "\002" body    regsub -all -nocase {&lt;br&gt;} $body " " body    regsub -all -nocase {&lt;/p&gt;} $body " " body    regexp {&lt;div class="result-text-style-normal"&gt;(.*?)&lt;p/&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;} $body - boddyforeach line [split $body \n] {  if {[string match "*&lt;div class=\"result-text-style-normal\"&gt;*" $line]} {    set start [string first "&lt;div class=\"result-text-style-normal\"&gt;" $line]    set start [expr {$start + 38}] ;# 38 is the number of characters in "&lt;div class=\"result-text-style-normal\"&gt;"    set end [string first "&lt;p/&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;" $line]    set end [expr {$end - 1}];# We don't want the "&lt;" from "&lt;p/&gt;"    set boddy [string range $line $start $end]  }}putlog "PRIVMSG #questions :Mark 4v1-9 '$boddy' THE END!"}  bind dcc n|n $dcctrigger our:dcctrigger  proc our:dcctrigger {hand idx text} {    global url    set sock [egghttp:geturl $url biblegateway]    return 1  }  putlog "biblegateway.tcl has been successfully loaded."}</code></pre></div>as you can see, i´ve tried everything - my last attempt was with the loop!<br><br>thanks in advance.<br>pilchards<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9858">malcsman</a> — Sat Apr 12, 2008 5:27 pm</p><hr />
]]></content>
	</entry>
	</feed>
