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

	<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>2005-06-13T06:23:19-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Robb]]></name></author>
		<updated>2005-06-13T06:23:19-04:00</updated>

		<published>2005-06-13T06:23:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50725#p50725</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50725#p50725"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50725#p50725"><![CDATA[
I prefer to use pure sockets.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Try this one..<br><div class="codebox"><p>Code: </p><pre><code>set url "www.tclscript.com"  proc get_projects {nick uhost handle channel text} {    global url    set sock [socket $url 80]    fconfigure $sock -buffering line -buffersize 1000    puts $sock "GET /scripts.shtml HTTP/1.0"    puts $sock "Host: www.tclscript.com"    puts $sock ""    flush $sock        while {![eof $sock]} {    gets $sock body    regexp -all {Total Projects: &lt;u&gt;(.*)&lt;/u&gt;} $body _ served    }        if {[eof $sock]} { close $sock }        regsub -all {(&lt;.+?&gt;)} $served "" served        puthelp "PRIVMSG $channel :www.tclscript.com has a total of [lindex $served 0] projects so far."    }bind pub - !projects get_projects</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6348">Robb</a> — Mon Jun 13, 2005 6:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-13T05:03:11-04:00</updated>

		<published>2005-06-13T05:03:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50716#p50716</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50716#p50716"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50716#p50716"><![CDATA[
With the help of the tutorial...<br><div class="codebox"><p>Code: </p><pre><code># egghttp_example.tcl# Configset url "http://www.tclscript.com/scripts.shtml"set dcctrigger "example"# End of configif {![info exists egghttp(version)]} {  putlog "egghttp.tcl was NOT successfully loaded."  putlog "egghttp_example.tcl has not been loaded as a result."} else {  proc your_callbackproc {sock} {    global url    set headers [egghttp:headers $sock]    set body [egghttp:data $sock]      regsub -all "\n" $body "" body    regsub -all -nocase {&lt;br&gt;} $body "&lt;br&gt;\n" body    regexp {Total Projects: &lt;u&gt;(.*)&lt;/u&gt;} $body - served    puthelp "PRIVMSG #macked :There are total of $served projects so far."  }  bind dcc o|o $dcctrigger our:dcctrigger  proc our:dcctrigger {hand idx text} {    global url     set sock [egghttp:geturl $url your_callbackproc]    return 1  }    putlog "egghttp_example.tcl has been successfully loaded."}</code></pre></div>For testing I edited the tutorial of <a href="http://www.tclscript.com/egghttp_tut.shtml" class="postlink">http://www.tclscript.com/egghttp_tut.shtml</a> but still no luck, I couldn't change the DCC bind trigger to pub for some reason, it wasn't working right, and I kept getting "wrong # args".<br><br>Also, my bot is msging the channel <br><br>There are total of 35&lt;/u&gt; ] - [ Total Projects For Download: &lt;u&gt;31&lt;/u&gt; ] - [ Total Downloads: &lt;u&gt;117518 projects so far.<br><br>However all I want is "<strong class="text-strong">There are total of 35</strong><span style="text-decoration:underline">&lt;/u&gt; ] - [ Total Projects For Download: &lt;u&gt;31&lt;/u&gt; ] - [ Total Downloads: &lt;u&gt;117518 </span><strong class="text-strong">projects so far.</strong>"<br><br>Also the reason I have &lt;u&gt;(.*)&lt;/u&gt; because if I don't I get "There are total of &lt;u&gt;35&lt;/u&gt; ] - [ Total Projects For Download: &lt;u&gt;31&lt;/u&gt; ] - [ Total Downloads: &lt;u&gt;117518&lt;/u&gt; ]  &lt;/center&gt;  &lt;font&gt;&lt;br&gt;" which is more messed up, I know it sounds weird but... :/<br><br>The underlined is completely unneeded, only the bolded part. Thanks for help.[/u]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 13, 2005 5:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-13T03:55:06-04:00</updated>

		<published>2005-06-13T03:55:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50707#p50707</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50707#p50707"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50707#p50707"><![CDATA[
The reason I wasn't able to get what you mean by the script you gave me, because you were thinking of a different thing, the script I have in mind isn't where it looks at each line to increase the value of $total, I'm really sorry to bother you, but the script I'm looking at is almost close to a google script for an example.<br><br><br>After typing -projects instead of counting the projects 1 by 1, I was looking for a script that msg the channel " [ Total Projects: 35 ]", which is found at the bottom of the page <a href="http://www.tclscript.com/scripts.shtml" class="postlink">http://www.tclscript.com/scripts.shtml</a>  so it won't be adding them up, only reading the number "35" that's why I thought egghttp would help me because it has (.*) after looking at <a href="http://www.tclscript.com/egghttp_tut.shtml" class="postlink">http://www.tclscript.com/egghttp_tut.shtml</a>. I hope you know what I mean, and I'm not giving you too much trouble.<br><br>Looking at the tutorial, it's a DCC trigger, I think I want it to be a public trigger msged to the channel insstead of saved in the log.<br><br>Thanks again.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 13, 2005 3:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-13T03:38:19-04:00</updated>

		<published>2005-06-13T03:38:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50700#p50700</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50700#p50700"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50700#p50700"><![CDATA[
For the example I'm using with website <a href="http://www.tclscript.com/scripts.shtml" class="postlink">http://www.tclscript.com/scripts.shtml</a> if you scroll to bottom you see " [ Total Projects: 35 ]". So I'm trying to make my bot say: "There are total of <strong class="text-strong">35</strong> projects. Of course 35 will be update with the site, if you get what I mean, so later if the site says "[ Total Projects: 36 ]", my bot will say: "There are total of <strong class="text-strong">36</strong> projects.<br><br>I will put the info you gave me together, and post more questions later, thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 13, 2005 3:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-13T03:31:57-04:00</updated>

		<published>2005-06-13T03:31:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50697#p50697</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50697#p50697"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50697#p50697"><![CDATA[
well, basically you need to read through that webpage and count the lines which contain a project description; all you gotta do is:<div class="codebox"><p>Code: </p><pre><code>set total 0foreach line [split [::http::data $token] \n] {  if [string match *someprojectpattern* $line] {incr total}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Jun 13, 2005 3:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-13T03:22:48-04:00</updated>

		<published>2005-06-13T03:22:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50693#p50693</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50693#p50693"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50693#p50693"><![CDATA[
I'm appreciating your help, the thing is I search "parse html" I wasn't able to find something on this forum, do you have a link where i could find how I can finish the script, I'm not asking you to make it, I just need few more hints.<br><br>The thing is, I have my script in mIRC and it works fine, I just need a small help in converting it into tcl. I know what I need to do, but not sure how to do it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Mon Jun 13, 2005 3:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-13T00:39:06-04:00</updated>

		<published>2005-06-13T00:39:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50682#p50682</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50682#p50682"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50682#p50682"><![CDATA[
this is not a complete script, you need to code the commented part yourself:<div class="codebox"><p>Code: </p><pre><code># parse $data, see how many project lines there is </code></pre></div>and calculate $total appropriately (search forum for "parse html" on info how to do that; hint: you may need to strip HTML tags first)<br><br>BTW, this isn't a forum for complete scripts also<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Jun 13, 2005 12:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-12T23:55:01-04:00</updated>

		<published>2005-06-12T23:55:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50679#p50679</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50679#p50679"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50679#p50679"><![CDATA[
Thanks a lot for your reply demond but I got this for error<br><blockquote class="uncited"><div> [22:53] Tcl error [aproc]: can't read "total": no such variable</div></blockquote>What should I set it to?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Sun Jun 12, 2005 11:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-12T15:14:01-04:00</updated>

		<published>2005-06-12T15:14:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50654#p50654</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50654#p50654"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50654#p50654"><![CDATA[
for fetching a single, simple webpage you normally don't need async I/O; if you really need that, you can use -command option of [::http::geturl], which specifies a callback to be invoked when HTTP transaction is complete ([geturl] returns immediately)<br><br>I've never used egghttp, but would guess it's been written for older TCL versions which don't provide the http package<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Jun 12, 2005 3:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2005-06-12T14:51:56-04:00</updated>

		<published>2005-06-12T14:51:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50649#p50649</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50649#p50649"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50649#p50649"><![CDATA[
that depends if you want async connections or not cause if i recall well <br><br>that script uses async sockets..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sun Jun 12, 2005 2:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-12T13:42:44-04:00</updated>

		<published>2005-06-12T13:42:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50643#p50643</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50643#p50643"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50643#p50643"><![CDATA[
there's no need of egghttp, TCL comes with built-in http package:<div class="codebox"><p>Code: </p><pre><code>package require httpbind pub - -projects aprocproc aproc {n u h c t} {  set token [::http::geturl http://www.tclscript.com/scripts.shtml]  set data [::http::data $token]  # parse $data, see how many project lines there is  puthelp "privmsg $c :total number of projects: $total"  ::http::cleanup $token}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Jun 12, 2005 1:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DarkJFMan]]></name></author>
		<updated>2005-06-12T06:46:19-04:00</updated>

		<published>2005-06-12T06:46:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50625#p50625</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50625#p50625"/>
		<title type="html"><![CDATA[Small socket script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50625#p50625"><![CDATA[
I'm just testing out socket with eggdrop, and have not been successful at all. Can someone make a script real quick or has a link to one similar where, for example:<br><br>Someone types: -projects<br><br>It will go to <a href="http://www.tclscript.com/scripts.shtml" class="postlink">http://www.tclscript.com/scripts.shtml</a> and get how many Total Projects there is.<br><br>I have egghttp.tcl on, I looked at <a href="http://www.tclscript.com/egghttp_tut.shtml" class="postlink">http://www.tclscript.com/egghttp_tut.shtml</a> but still no luck getting the right script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4261">DarkJFMan</a> — Sun Jun 12, 2005 6:46 am</p><hr />
]]></content>
	</entry>
	</feed>
