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

	<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-09-12T12:30:41-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2005-09-12T12:30:41-04:00</updated>

		<published>2005-09-12T12:30:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55650#p55650</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55650#p55650"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55650#p55650"><![CDATA[
I'd go for 'setudef' and 'channel get' (check the tcl-commands.doc file) instead of a some specified in a variable way if you want to have commands just for one or some specific channels, this in case the list of allowed channels changes.<br><br>Post what errors you get (see <a href="http://forum.egghelp.org/viewtopic.php?t=10215" class="postlink">this</a> page for instructions).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Sep 12, 2005 12:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-12T04:39:32-04:00</updated>

		<published>2005-09-12T04:39:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55639#p55639</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55639#p55639"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55639#p55639"><![CDATA[
Anyone any ideas <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>Joel<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Mon Sep 12, 2005 4:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-09T10:03:21-04:00</updated>

		<published>2005-09-09T10:03:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55522#p55522</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55522#p55522"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55522#p55522"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set allowedchans "#linod"set streamip ""set streamport "9000"set streampass ""bind pub * !stats stats_run# Basic Edit Functionsproc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }#Command Functionsproc stats_run {nick uhost hand chan rest} {   global streamip streamport streampass allowedchans      if {(([lsearch -exact [string tolower $allowedchans] [string tolower $chan]] != -1)||($allowedchans == "*"))} {          if {[catch {set sock [socket $streamip $streamport] } sockerror]} {             putlog "error: $sockerror"             return 0     } else {if {[catch {set sock [socket $streamip $streamport] } sockerror]} {putlog "error: $sockerror"return 0 } else {puts $sock "GET /admin.cgi?pass=$streampass&amp;mode=viewxml&amp;page=0 HTTP/1.0"puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"puts $sock "Host: $streamip"puts $sock "Connection: close"puts $sock ""flush $sockputlog "debug 01 $chan"while {[eof $sock] != 1} {set bl [gets $sock]if { [string first "standalone" $bl] != -1 } {set streamstatus [string range $bl [shrink + 14 "&lt;STREAMSTATUS&gt;" 0 $bl] [shrink - 1 "&lt;/STREAMSTATUS&gt;" 0 $bl]]}}close $sock} if { $streamstatus == "1" } {putlog "shoutcast: $nick asked for serverstats from $chan"if {[catch {set sock [socket $streamip $streamport] } sockerror]} {putlog "error: $sockerror"return 0} else {puts $sock "GET /admin.cgi?pass=$streampass&amp;mode=viewxml&amp;page=0 HTTP/1.0"puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"puts $sock "Host: $streamip"puts $sock "Connection: close"puts $sock ""flush $sockputlog "debug 02 $chan"while {[eof $sock] != 1} {putlog "debug 03 $chan"set bl [gets $sock]putlog "debug 04 $chan"if { [string first "standalone" $bl] != -1 } {putlog "Generating info"set streamstatus [string range $bl [shrink + 14 "&lt;STREAMSTATUS&gt;" 0 $bl] [shrink - 1 "&lt;/STREAMSTATUS&gt;" 0 $bl]]set repl [string range $bl [shrink + 19 "&lt;REPORTEDLISTENERS&gt;" 0 $bl] [shrink - 1 "&lt;/REPORTEDLISTENERS&gt;" 0 $bl]]set curhigh [string range $bl [shrink + 15 "&lt;PEAKLISTENERS&gt;" 0 $bl] [shrink - 1 "&lt;/PEAKLISTENERS&gt;" 0 $bl]]set currentl [string range $bl [shrink + 18 "&lt;CURRENTLISTENERS&gt;" 0 $bl] [shrink - 1 "&lt;/CURRENTLISTENERS&gt;" 0 $bl]]set surl [string range $bl [shrink + 11 "&lt;SERVERURL&gt;" 0 $bl] [shrink - 1 "&lt;/SERVERURL&gt;" 0 $bl]]set maxl [string range $bl [shrink + 14 "&lt;MAXLISTENERS&gt;" 0 $bl] [shrink - 1 "&lt;/MAXLISTENERS&gt;" 0 $bl]]set bitrate [string range $bl [shrink + 9 "&lt;BITRATE&gt;" 0 $bl] [shrink - 1 "&lt;/BITRATE&gt;" 0 $bl]]set stitle [string range $bl [shrink + 13 "&lt;SERVERTITLE&gt;" 0 $bl] [shrink - 1 "&lt;/SERVERTITLE&gt;" 0 $bl]]set sgenre [string range $bl [shrink + 13 "&lt;SERVERGENRE&gt;" 0 $bl] [shrink - 1 "&lt;/SERVERGENRE&gt;" 0 $bl]]if {$sgenre != ""} {set sgenre " ($sgenre)"}set avgtime [string range $bl [shrink + 13 "&lt;AVERAGETIME&gt;" 0 $bl] [shrink - 1 "&lt;/AVERAGETIME&gt;" 0 $bl]]set irc [string range $bl [shrink + 5 "&lt;IRC&gt;" 0 $bl] [shrink - 1 "&lt;/IRC&gt;" 0 $bl]]set webhits [string range $bl [shrink + 9 "&lt;WEBHITS&gt;" 0 $bl] [shrink - 1 "&lt;/WEBHITS&gt;" 0 $bl]]set streamhits [string range $bl [shrink + 12 "&lt;STREAMHITS&gt;" 0 $bl] [shrink - 1 "&lt;/STREAMHITS&gt;" 0 $bl]]set version [string range $bl [shrink + 9 "&lt;VERSION&gt;" 0 $bl] [shrink - 1 "&lt;/VERSION&gt;" 0 $bl]]}close $sock}}putchan $chan "$stitle$sgenre is online, running shoutcast $version and streaming at $bitrate kbps,  your dj is $dj. please visit $surl" putchan $chan "$stitle$sgenre is online, running shoutcast $version and streaming at $bitrate kbps,  your dj is $dj. please visit $surl"putchan $chan "there are currently $repl unique people listening, the listener maximum is $maxl, our user peak was at $curhigh listeners."putchan $chan "the average user is listening $avgtime seconds, our stream had $webhits webhits and $streamhits streamhits."putchan $chan "you can contact the team by irc on $irc"} else { return 0}}}}</code></pre></div>Right well after some broken bits, i think i'm nearly there, once i've cracked this bit i should be ok for the rest,<br><br>I'm getting a weird thing going on now, not sure what i've done, but when i do !stats in the chan i get a TCL error:<br><br>Tcl error [stats_run]: can not find channel named "sock24"<br><br>the 24 on the end incriments by one every time i run the command. I cant see where i've ended up looping the chan name into that :s<br><br>the last message i get to the party line is debug 04 $chan, so i think its after that that causes the problem, unless its further up and i just cant see it :s<br><br>Thanks in advance<br><br>Joel.... Slowly getting the hang of this :S<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Fri Sep 09, 2005 10:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-09T09:31:15-04:00</updated>

		<published>2005-09-09T09:31:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55521#p55521</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55521#p55521"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55521#p55521"><![CDATA[
Doh, what a plonker...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Fri Sep 09, 2005 9:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oxygen]]></name></author>
		<updated>2005-09-09T09:21:58-04:00</updated>

		<published>2005-09-09T09:21:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55519#p55519</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55519#p55519"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55519#p55519"><![CDATA[
hi Joel<br><br>I think a proc is missing. maybe something like that?<div class="codebox"><p>Code: </p><pre><code>proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }</code></pre></div>hope it helps<br><br>friendly regards<br>oxygen<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6688">oxygen</a> — Fri Sep 09, 2005 9:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-09T09:58:50-04:00</updated>

		<published>2005-09-09T09:03:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55518#p55518</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55518#p55518"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55518#p55518"><![CDATA[
Thankyou kindly for your help, added that, and sorted a problem with the position of my { and } (I think :S)<br><br>anyway, I now have this <div class="codebox"><p>Code: </p><pre><code>--- Code Cut ---</code></pre></div>But get the error<br><br>[13:53] Tcl error [stats_run]: invalid command name "shrink"<br><br>Have i got something in the wrong place? excude my n00b ness, but I'm more familiar with PHP, just getting started in this arena :S<br><br>Oh and out of interest, what editor do people use? I could really do with one with auto indent? jEdit doesnt seem to do it.<br><br>Joel<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Fri Sep 09, 2005 9:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oxygen]]></name></author>
		<updated>2005-09-09T07:52:02-04:00</updated>

		<published>2005-09-09T07:52:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55517#p55517</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55517#p55517"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55517#p55517"><![CDATA[
hi Joel<br><br>maybe because:<div class="codebox"><p>Code: </p><pre><code>if {($chan != $radiochans) || ($chan != $adminchans)}{ </code></pre></div>must be:<div class="codebox"><p>Code: </p><pre><code>if {($chan != $radiochans) || ($chan != $adminchans)} { </code></pre></div>but to check allowed chans try this:<div class="codebox"><p>Code: </p><pre><code>set allowedchans "#chan #chan.admin"bind * !stats stats_run proc stats_run {nick uhost hand chan rest} {    global streamip streamport streampass allowedchans       if {(([lsearch -exact [string tolower $allowedchans] [string tolower $chan]] != -1)||($allowedchans == "*"))} {          if {[catch {set sock [socket $streamip $streamport] } sockerror]} {              putlog "error: $sockerror"              return 0           } else {             blabla....</code></pre></div>hope this helps. btw. the first if must be in one line<br><br>friendly regards<br>oxygen<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6688">oxygen</a> — Fri Sep 09, 2005 7:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-09T07:22:55-04:00</updated>

		<published>2005-09-09T07:22:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55515#p55515</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55515#p55515"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55515#p55515"><![CDATA[
Ah, right, updated the code above, but i'm getting a silly error that i cant seem to see whats causing it<br><br>12:24 &lt;KryptoBot&gt;12:21] Tcl error [stats_run]: extra characters after<br>                  close-brace<br><br>is it something to do with newline chars?<br><br>Joel<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Fri Sep 09, 2005 7:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-09-09T05:38:49-04:00</updated>

		<published>2005-09-09T05:38:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55512#p55512</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55512#p55512"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55512#p55512"><![CDATA[
you can't [bind pub] to channel, but you can check inside the proc if $chan is allowed for that command<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Sep 09, 2005 5:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Joel]]></name></author>
		<updated>2005-09-09T08:58:28-04:00</updated>

		<published>2005-09-09T05:23:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=55511#p55511</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=55511#p55511"/>
		<title type="html"><![CDATA[Binding commands to a single set of channels]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=55511#p55511"><![CDATA[
--new code below--<br><br><br>Is what i have, but my bot sits in a load of channels, but i only want the commands to be available in #chan and #chan.admin? How do i bind the script to those channels?<br><br>Joel<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6692">Joel</a> — Fri Sep 09, 2005 5:23 am</p><hr />
]]></content>
	</entry>
	</feed>
