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

	<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>2007-12-16T23:06:43-04:00</updated>

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

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-16T23:06:43-04:00</updated>

		<published>2007-12-16T23:06:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79385#p79385</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79385#p79385"/>
		<title type="html"><![CDATA[Regexp Problem.. SOS]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79385#p79385"><![CDATA[
Actually, since it doesn't look like that webpage is gonna change much at all, why not just grab a copy and store it all in an array after reading it from disk (after cleaning up and saving it to disk), then you don't have to wait for it to grab the webpage everytime there's a query..  Arrays can be fun! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>My earth calendar script does that, so does the tvrage script. They pull in fresh data once in a while just in case there's been changes..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Dec 16, 2007 11:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-16T22:58:08-04:00</updated>

		<published>2007-12-16T22:58:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79383#p79383</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79383#p79383"/>
		<title type="html"><![CDATA[Regexp Problem.. SOS]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79383#p79383"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set timeout "60000"set text [split [string tolower $text]]set query "http://www.tibia.com/library/?subtopic=spells"# Check if we even get the webpage?catch {set page [::http::geturl $query -timeout $timeout]} errorif {[string match -nocase "*couldn't open socket*" $error]} {puthelp "PRIVMSG $chan :Error: couldn't connect..Try again later."return}if { [::http::status $page] == "timeout" } {puthelp "PRIVMSG $chan :Error: Connection to timed out..Try again later."return}set html [::http::data $page]# regexp won't expand $vars, so do it here first:set regex "HREF=\"http://www.tibia.com/library/?subtopic=spells&amp;spell=.*?\"&gt;(.*?)&lt;/A&gt; \($text\)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;/TR&gt;&lt;TR BGCOLOR=.*?&lt;TD&gt;"if {[regexp $regex $html match spell cat type lvl mana price prem]} {        puthelp "PRIVMSG $chan :$spell / Formula: $text / Category: $cat / Type: $type / Lvl: $lvl / Mana: $mana / Price: $price / Premium: $prem"} else {         puthelp "PRIVMSG $chan :Can't get data..."}</code></pre></div>Thats the jist of it. Do more error checking,  use a var to expand input vars for regexp, and use PRIVMSG (uppercase) as I do believe it's case sensitive (might be wrong on that, I've always used uppercase.). <br><br>The locations of my subexpressions (.*?) might not be completely what you wanted, I just grabbed everything with regexp, edit to suit..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Dec 16, 2007 10:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-12-16T21:12:07-04:00</updated>

		<published>2007-12-16T21:12:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79380#p79380</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79380#p79380"/>
		<title type="html"><![CDATA[Regexp Problem.. SOS]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79380#p79380"><![CDATA[
A little "light" reading is in order: <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/regexp.htm" class="postlink">regexp</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Sun Dec 16, 2007 9:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[angelbroz]]></name></author>
		<updated>2007-12-16T17:32:07-04:00</updated>

		<published>2007-12-16T17:32:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79371#p79371</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79371#p79371"/>
		<title type="html"><![CDATA[Regexp Problem.. SOS]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79371#p79371"><![CDATA[
Hi there i'm making a script<br><br>I'd like to get somes values from a webpage<br><br>&gt;Groundshaker&lt;/A&gt; <strong class="text-strong">(exori mas) </strong>&lt;/TD&gt;&lt;TD&gt;Attack &lt;/TD&gt;&lt;TD&gt;Instant&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;.......<br><br>i have something<br><div class="codebox"><p>Code: </p><pre><code>proc spell {nick uhost hand chan text} {#set text [string totitle $text]set query "http://www.tibia.com/library/?subtopic=spells"set http [::http::geturl $query]set html [::http::data $http]set k "&gt;(.*?)&lt;/A&gt; \($text\)&lt;/TD&gt;&lt;TD&gt;(.*?) &lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;TD&gt;(.*?)&lt;/TD&gt;&lt;/TR&gt;"regexp $k $html - spell cat type lvl mana price prem  putserv "privmsg $chan :$spell / Formula: $text / Category: $cat / Type: $type / Lvl: $lvl / Mana: $mana / Price: $price / Premium: $prem"}</code></pre></div><br>but dont works  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>[14:44] &lt;~angelbroz&gt; !spell exori has<br><br>Tcl error [spell]: couldn't compile regular expression pattern: parentheses () not balanced<br><br>plx help<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9555">angelbroz</a> — Sun Dec 16, 2007 5:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
