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

	<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>2009-11-28T17:14:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Sandzo]]></name></author>
		<updated>2009-11-28T17:14:48-04:00</updated>

		<published>2009-11-28T17:14:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91117#p91117</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91117#p91117"/>
		<title type="html"><![CDATA[help in sc.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91117#p91117"><![CDATA[
Hallo,<br><br>I have a problem. I want to modify the script sc.tcl by LoReZ. <br><br>I want to leave the "!setdj" command out of the .tcl file. I've changed the trigger (in the .cfg file) when someone types "!dj" that the script shows on channel the dj name via the AIM of the shoutcast stream.<br><blockquote class="uncited"><div># DJ Trigger<br>set sc::triggers(dj) "dj"<br># Text when someone uses the DJ Trigger<br>set sc::texts(dj) "Trenutno program vodi <strong class="text-strong">%aim</strong>"</div></blockquote><br>That wasn't a problem. But I have problems with the tcl script. I want the script use the AIM of the stream automatically as DJ and send the wishes and greets to this nick.<br><blockquote class="uncited"><div>###############################################################################################################################<br>#                                                                                                                             # <br># LoReZ ShoutCast Script v2.1 (sc.tcl)                                                                                        #<br># Email: <a href="mailto:lorez@bigvibez.com">lorez@bigvibez.com</a>                                                                                                   #<br># IRC: #bigvibez @ Quakenet                                                                                                   #<br>#                                                                                                                             #<br># Please contact me if you notice any bugs                                                                                    #<br>#                                                                                                                             #<br># Installation: Put the script and the config file into your scripts directory, add "source scripts/sc.tcl" to your eggdrop   #<br>#               config and rehash the bot. (http package is REQUIRED for this script to work)                                 #                                                                                              #<br>#                                                                                                                             #<br>###############################################################################################################################<br><br>###############################################################################################################################<br>#                                                          START OF TCL CODE                                                  #<br>###############################################################################################################################<br><br>package require http<br>namespace eval sc {<br>    variable vars<br>    variable sets<br>    variable triggers<br>    variable texts<br>    variable offadv 0<br>    source scripts/sc.cfg<br>    proc init {} {<br>set start [clock clicks]<br>set sc::offadv 0<br>bind time - "* * * * *" sc::check<br>bind nick - * sc::nick<br>foreach x [array names sc::triggers] {<br>    if {$sc::sets(pub) == 1} {<br>bind pub [expr {($x == "kick") || ($x == "setdj") || ($x == "unsetdj") ? "$sc::vars(flag)" : "-"}] $sc::vars(trigger)$sc::triggers($x) "sc::pub $x"<br>    }<br>    if {$sc::sets(msg) == 1} {<br>bind msg [expr {($x == "kick") || ($x == "setdj") || ($x == "unsetdj") ? "$sc::vars(flag)" : "-"}] $sc::vars(trigger)$sc::triggers($x) "sc::msg $x"<br>    }<br>}<br>if {$sc::sets(adv) == 1} {<br>    timer $sc::sets(advtime) "sc::post privmsg none all {$sc::texts(adv)}"<br>}<br>putlog "sc.tcl v2.1 by LoReZ successfully initialized in [expr {([clock clicks]-$start)/1000.0}]ms"<br>    }<br>    proc pub {text nick uhost hand chan args} {<br>if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chan]] != -1) || ($sc::vars(chans) == "")} {<br>    sc::cmd $text $nick $chan $args<br>}<br>    }<br>    proc msg {text nick uhost hand args} {<br>sc::cmd $text $nick none $args<br>    }<br>    proc nick {nick uhost hand chan newnick} {<br>set tmp [open $sc::vars(file) r]<br>gets $tmp streamdata<br>gets $tmp songdata<br>gets $tmp djdata<br>close $tmp<br>if {$nick == [lindex $djdata 0]} {<br>    set tmp [open $sc::vars(file) w+]<br>    puts $tmp $streamdata<br>    puts $tmp $songdata<br>    puts $tmp "$newnick [expr {([lindex $djdata 1] == $nick) ? $newnick : [lindex $djdata 1]}] [lrange $djdata 2 end]"<br>    close $tmp<br>    if {([lindex $djdata 1] == $nick) &amp;&amp; ($sc::sets(djtopchg) == 1)} {<br>sc::post topic none all "$sc::texts(djtopic)"<br>    }<br>}    <br>    }<br>    proc cmd {text nick chan args} {<br>if {[file exists $sc::vars(file)] != 1} {<br>    sc::check * * * * *<br>}<br>set tmp [open $sc::vars(file) r]<br>gets $tmp streamdata<br>gets $tmp songdata<br>gets $tmp djdata<br>close $tmp<br>switch -exact $text {<br>    help {<br>set sc::offadv 1<br>putquick "privmsg $nick :Komande koje mozete koristiti:"<br>foreach x [array names sc::triggers] {<br>    if {$x != "help"} {<br>if {(([matchattr [nick2hand $nick $chan] +$sc::vars(flag) $chan] != 1) &amp;&amp; ($x != "kick") &amp;&amp; ($x != "setdj") &amp;&amp; ($x != "unsetdj")) || ([matchattr [nick2hand $nick $chan] +$sc::vars(flag) $chan] == 1)} {<br>    set sc::offadv 1<br>    putquick "privmsg $nick :$sc::vars(trigger)[expr {($x == "setdj") ? "$sc::triggers($x) &lt;djname&gt; &lt;showname&gt;" : [expr {(($x == "pjesma") || ($x == "pozdrav")) ? "$sc::triggers($x) &lt;$x&gt;" : "$sc::triggers($x)"}]}]"  <br>}<br>    }<br>}<br>set sc::offadv 1<br>putquick "privmsg $nick :Kraj liste"<br>    }<br>    kick {<br>putquick "privmsg $nick :Source successfully kicked"<br>if {[lindex $streamdata 15] == 1} {<br>    set sock [socket $sc::vars(ip) $sc::vars(port)]<br>    puts $sock "GET /admin.cgi?mode=kicksrc HTTP/1.1"<br>    puts $sock "User-Agent:Mozilla"<br>    puts $sock "Host: $sc::vars(ip)"<br>    puts $sock "Authorization: Basic $sc::vars(adpass)"<br>    puts $sock ""<br>    flush $sock<br>}<br>    }<br>    setdj {<br>putquick "privmsg $nick :New DJ set"<br>if {[lindex $streamdata 15] == 1} {<br>    set tmp [open $sc::vars(file) w+]<br>    puts $tmp $streamdata<br>    puts $tmp $songdata<br>    puts $tmp "$nick [expr {([lindex $args 0] == "{}") ? $nick : [lindex [lindex $args 0] 0]}] [lrange [lindex $args 0] 1 end]"<br>    close $tmp<br>    if {$sc::sets(anndj) == 1} {<br>sc::post privmsg none all "$sc::texts(djchg)"<br>    }<br>    if {$sc::sets(djtopchg) == 1} {<br>sc::post topic none all "$sc::texts(djtopic)"<br>    }<br>}<br>    }<br>    unsetdj {<br>putquick "privmsg $nick :DJ unset"<br>if {[lindex $streamdata 15] == 1} {<br>    set tmp [open $sc::vars(file) w+]<br>    puts $tmp $streamdata<br>    puts $tmp $songdata<br>    puts $tmp "none none none"<br>    close $tmp<br>    if {$sc::sets(anndj) == 1} {<br>sc::post privmsg none all "$sc::texts(djchg)"<br>    }<br>    if {$sc::sets(djtopchg) == 1} {<br>sc::post topic none all "$sc::texts(ontopic)"<br>    }<br>}<br>    }<br>    default {<br>if {($text != "wish") &amp;&amp; ($text != "greet")} {<br>    sc::post privmsg $nick $chan "$sc::texts($text)"<br>} else {<br>    if {[lindex $streamdata 15] == 1} {<br>if {([lindex $args 0] == "{}")} {<br>putquick "privmsg $nick :Niste ukucali naziv pjesme"<br>} else {<br>    if {[lindex $djdata 1] == "none"} {<br>putquick "privmsg $sc::vars(intern) :[string totitle $text] by $nick: $args"<br>    } else {<br>putquick "privmsg [expr {($sc::sets(wishgreet) == 1) ? $sc::vars(intern) : [lindex $djdata 0]}] :[string totitle $text] by $nick: $args"<br>putquick "privmsg $nick :[string totitle $text] sent to [expr {($sc::sets(wishgreet) == 1) ? $sc::vars(intern) : [lindex $djdata 0]}]"    <br>    }<br>}<br>    } else {<br>sc::post privmsg $nick none "$sc::texts(offcmd)"<br>    }<br>}<br>    }<br>}<br>putlog "sc.tcl v2.1 $nick used $sc::vars(trigger)$sc::triggers($text)"<br>    }           <br>    proc check {min hour day month year} {<br>set start [clock clicks]<br>if {[file exists $sc::vars(file)] == 1} {<br>    set tmp [open $sc::vars(file) r]<br>    gets $tmp olddata<br>    gets $tmp songdata<br>    gets $tmp djdata<br>    close $tmp<br>} else {<br>    set olddata "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"<br>    set djdata "none none none"<br>}<br>http::config -useragent "Mozilla 5.0"<br>set con [http::geturl http://$sc::vars(ip):$sc::vars(port)/admin.cgi?pass=$sc::vars(pass)&amp;mode=viewxml&amp;page=0 -timeout 10000]<br>set urldata [http::data $con]<br>http::cleanup $con <br>foreach {y z} {21 ! 22 \" 23 # 24 \$ 25 % 26 + 27 ' 28 \( 29 \) 2A * 2B + 2C , 2E . 2F / 3A : 3B \; 3C &lt; 3D = 3E &gt; 3F ? 40 @ 5B \[ 5C \\ 5D \] 5F _ 60 ` C0 À C1 Á C2 Â C3 Ã C4 Ä C5 Å C6 Æ C7 Ç C8 È C9 É CA Ê CB Ë CC Ì CD Í CE Î CF Ï D1 Ñ D2 Ò D3 Ó D4 Ô D5 Õ D6 Ö D9 Ù DA Ú DB Û DC Ü DD Ý DF ß E0 à E1 á E2 â E3 ã E4 ä E5 å E6 æ E7 ç E8 è E9 é EA ê EB ë EC ì ED í EE î EF ï F0 ð F1 ñ F2 ò F3 ó F4 ô F5 õ F6 ö F9 ù FA ú FB û FC ü FD ý FE þ FF ÿ} {<br>    regsub -all "&amp;#x$y;" $urldata "$z" urldata <br>}<br>regsub -all ".*&lt;SHOUTCASTSERVER&gt;" $urldata "" data1<br>regsub -all "&lt;WEBDATA&gt;.*" $data1 "" data1<br>regsub -all ".*&lt;SONGHISTORY&gt;" $urldata "\{" data2<br>regsub -all "&lt;/SONGHISTORY&gt;.*" $data2 " \}" data2<br>set x 0<br>foreach y {CURRENTLISTENERS PEAKLISTENERS MAXLISTENERS REPORTEDLISTENERS AVERAGETIME SERVERGENRE SERVERURL SERVERTITLE SONGTITLE SONGURL IRC ICQ AIM WEBHITS STREAMHITS STREAMSTATUS BITRATE CONTENT VERSION SONG PLAYEDAT TITLE} {<br>    if {$x &lt; 19} {<br>regsub -all ".*&lt;$y&gt;" $data1 "" data10<br>regsub -all "&lt;/$y&gt;.*" $data10 "" data10<br>lappend streamdata [expr {(($data10 == "0") || ($data10 == "")) &amp;&amp; ([string match -nocase *listeners "$y"] != 1) &amp;&amp; ([string match -nocase *hits "$y"] != 1) &amp;&amp; ([string match -nocase *time "$y"] != 1) ? "N/A" : $data10}]<br>    }<br>    if {$x &gt; 18} {<br>regsub -all "&lt;$y&gt;" $data2 "\{" data2<br>regsub -all "&lt;/$y&gt;" $data2 "\} " data2<br>    }<br>    incr x<br>}<br>set tmp [open $sc::vars(file) w+]<br>puts $tmp $streamdata<br>puts $tmp $data2<br>puts $tmp $djdata<br>close $tmp<br>if {[lindex $olddata 15] != [lindex $streamdata 15]} {<br>    if { ($sc::sets(ann) == 1)} {<br>set sc::offadv [expr {([lindex $streamdata 15] == 1) ? 0 : 1}]<br>sc::post privmsg none all "[expr {([lindex $streamdata 15] == 1) ? $sc::texts(on) : $sc::texts(off)}]"<br>    }<br>    if {$sc::sets(topchg) == 1} {<br>set sc::offadv [expr {([lindex $streamdata 15] == 1) ? 0 : 1}]<br>sc::post topic none all "[expr {([lindex $streamdata 15] == 1) ? $sc::texts(ontopic) : $sc::texts(offtopic)}]"<br>    }<br>}<br>foreach {x y z} {8 anntrack songchg 0 annlist listchg 1 annpeak peakchg 16 annbitrate bitratechg} {<br>    if {([lindex $olddata $x] != [lindex $streamdata $x]) &amp;&amp; ($sc::sets($y) == 1)} {<br>sc::post privmsg all all "$sc::texts($z)"<br>    }<br>}<br>putlog "sc.tcl v2.1 received information from $sc::vars(ip):$sc::vars(port) in [expr {([clock clicks]-$start)/1000.0}]ms"<br>    }              <br>    proc post {mode nick chan text} {<br>set tmp [open $sc::vars(file) r]<br>gets $tmp streamdata<br>gets $tmp songdata<br>gets $tmp djdata<br>close $tmp<br>if {([lindex $streamdata 15] == 1) || ($sc::offadv == 1)} {<br>    foreach x [lindex $songdata 0] {<br>append lastsongs "[lindex $x 1] :: "<br>    }<br>    lappend streamdata $sc::vars(ip) $sc::vars(port) $sc::vars(desc) ":: $lastsongs" [expr {(([lindex $djdata 0] == "none") || ([lindex $djdata 0] == "{}") || ([lindex $djdata 0] == "")) ? "No DJ" : [lindex $djdata 0]}] [expr {(([lindex $djdata 1] == "none") || ([lindex $djdata 1] == "{}") || ([lindex $djdata 1] == "")) ? "No DJ" : [lindex $djdata 1]}] [expr {(([lindex $djdata 2] == "none") || ([lindex $djdata 2] == "{}") || ([lindex $djdata 2] == "")) ? "No Show" : [lrange $djdata 2 end]}] [expr {([lindex $streamdata 15] == 1) ? "online" : "offline"}]<br>    set x 0<br>    foreach y {listeners peak max unique avgtime genre url title song songurl irc icq aim webhits streamhits streamstatus bitrate content version ip port desc lastsongs djnick dj showname status} {<br>regsub -all "%$y" $text "[lindex $streamdata $x]" text<br>incr x<br>    }<br>    if {$mode == "topic"} {<br>foreach chans [channels] {<br>    if {$sc::vars(chans) == ""} {<br>if {$sc::sets(qtopic) == 1} {<br>    putquick "privmsg <a href="mailto:TheQBot@CServe.quakenet.org">TheQBot@CServe.quakenet.org</a> :SETTOPIC $chans $text"<br>} else {<br>    putquick "$mode $chans :$text"<br>}<br>    } else {<br>if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chans]] != -1)} {<br>    if {$sc::sets(qtopic) == 1} {<br>putquick "privmsg <a href="mailto:TheQBot@CServe.quakenet.org">TheQBot@CServe.quakenet.org</a> :SETTOPIC $chans $text"<br>    } else {<br>putquick "$mode $chans :$text"<br>    }<br>}<br>    }<br>}<br>    } else {<br>if {($sc::sets(reply) != 1) || ($chan == "none")} {<br>    putquick "$mode $nick :$text"<br>}<br>if {(($sc::sets(reply) == 1) &amp;&amp; ($chan != "none")) || ($chan == "all")} {<br>    foreach chans [channels] {<br>if {$sc::vars(chans) == ""} {<br>    putquick "$mode $chans :$text"<br>} else {<br>    if {([lsearch -exact [string tolower $sc::vars(chans)] [string tolower $chans]] != -1)} {<br>putquick "$mode $chans :$text"<br>    }<br>}<br>    }<br>}<br>    }<br>} else {<br>    putquick "$mode [expr {((($sc::sets(reply) != 1) || ($chan == "none")) &amp;&amp; ($chan != "all")) ? $nick : $chan}] :$sc::texts(offcmd)"<br>}<br>set sc::offadv 0<br>    }<br>    sc::init<br>}<br><br>###############################################################################################################################<br>#                                                           END OF TCL CODE                                                   #<br>###############################################################################################################################</div></blockquote><br>I don't know how and where I have to change sth. in the .tcl file.<br><br>I hope sb. can help me as fast as possible.<br><br>Thanks<br><br>Kind regards from Germany...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10995">Sandzo</a> — Sat Nov 28, 2009 5:14 pm</p><hr />
]]></content>
	</entry>
	</feed>
