[Addon] Script=BitComet Statistics Version=1.1 Author=Aaru Bui Desc=Displays BitComet Statistics. Very little info is available at the moment. For=mIRC Date=September 25, 2005 [script] n0=;######################################################## n1=;# Startup # n2=;######################################################## n3=on *:LOAD: { echo -s 12BitComet Statistics Script 0.9 Loaded } n4=on *:UNLOAD: { echo -s 12BitComet Statistics Script 0.9 Unloaded | unset %bc.* } n5= n6=;######################################################## n7=;# Show Stats # n8=;######################################################## n9=alias bc { n10= set %bc-location %bc.location $+ Downloads.xml n11= if (%bc.color1 isnum 0-15) { if (%bc.color1 < 10) { set %bc-color1 0 $+ %bc.color1 } | else { set %bc-color1  $+ %bc.color1 } } | else { set %bc.color1 1 | set %bc-color1 01 } n12= if (%bc.color2 isnum 0-15) { if (%bc.color2 < 10) { set %bc-color2 0 $+ %bc.color2 } | else { set %bc-color2  $+ %bc.color2 } } | else { set %bc.color2 1 | set %bc-color2 01 } n13= if (%bc.separator == $null) { set %bc.separator - } n14= if ($exists(%bc-location) != $true) { echo 02Cannot find Downloads.xml in selected BitComet Directory. Your version might not be supported. } | else { n15= if ($chan == $null) { echo 02You are not on a channel. } | else { n16= n17= set %bc-ultorrents 0 | set %bc-dltorrents 0 | set %bc-line 1 n18= :count n19= if (%bc-line < $lines(%bc-location)) { if (AutoRun="true" isin $read(%bc-location,%bc-line)) { if (SeedOnly="false" isin $read(%bc-location,%bc-line)) { set %bc-dltorrents $calc(%bc-dltorrents + 1) } | else { set %bc-ultorrents $calc(%bc-ultorrents + 1) } } | set %bc-line $calc(%bc-line + 1) | goto count } n20= n21= set %bc-filesize^ $calc($findtok($read(%bc-location,4),$chr(32) $+ SelectedSize=,34) + 1) n22= set %bc-left^ $calc($findtok($read(%bc-location,4),$chr(32) $+ Left=,34) + 1) n23= set %bc-upload^ $calc($findtok($read(%bc-location,4),$chr(32) $+ DataUpload=,34) + 1) n24= set %bc-download^ $calc($findtok($read(%bc-location,4),$chr(32) $+ DataDownload=,34) + 1) n25= set %bc-name^ $calc($findtok($read(%bc-location,4),$chr(32) $+ ShowName=,34) + 1) n26= if (%bc-filesize^ == $null || %bc-left^ == $null || %bc-upload^ == $null || %bc-download^ == $null || %bc-name^ == $null) { echo 02No torrents are running or your version of BitComet is not supported. | goto end } n27= n28= if (%bc-dltorrents = 0 && %bc-ultorrents = 0) { echo 02No active torrents running or your version might not be supported. | goto end } n29= if (%bc-dltorrents != 0) { n30= if (%bc-dltorrents = 1) { set %bc-torrent torrent } | else { set %bc-torrent torrents } n31= msg $chan %bc-color1 $+ BitComet is now downloading %bc-color2 $+ %bc-dltorrents $+  %bc-color1 $+ %bc-torrent $+ . n32= n33= set %bc-line 1 | set %bc-torrentcount 1 n34= :show_stats n35= if (%bc-dltorrents != 0) { n36= n37= if ((AutoRun="true" isin $read(%bc-location,%bc-line)) && (SeedOnly="false" isin $read(%bc-location,%bc-line))) { n38= set %bc-filesize $gettok($read(%bc-location,%bc-line),%bc-filesize^,34) n39= set %bc-percent $round($calc((1 - $gettok($read(%bc-location,%bc-line),%bc-left^,34) / %bc-filesize) * 100),2) n40= if (%bc-filesize < 1024) { set %bc-filesize $round(%bc-filesize,2) B } | elseif (%bc-filesize < 1048576) { set %bc-filesize $round($calc(%bc-filesize / 1024),2) KB } | elseif (%bc-filesize < 1073741824) { set %bc-filesize $round($calc(%bc-filesize / 1048576),2) MB } | else { set %bc-filesize $round($calc(%bc-filesize / 1073741824),2) GB } n41= set %bc-name $gettok($read(%bc-location,%bc-line),%bc-name^,34) n42= if ($gettok($read(%bc-location,%bc-line),%bc-upload^,34) > 0 && $gettok($read(%bc-location,%bc-line),%bc-download^,34) == 0) { set %bc-ratio Inf. } | else { set %bc-ratio $round($calc($gettok($read(%bc-location,%bc-line),%bc-upload^,34) / $gettok($read(%bc-location,%bc-line),%bc-download^,34)),2) } n43= n44= msg $chan %bc-color1 $+ Torrent %bc-color2 $+ %bc-torrentcount $+ %bc-color1 $+ : %bc-color2 $+ %bc-name $+  %bc-color1 $+ ( $+ %bc-color2 $+ %bc-filesize $+ %bc-color1 $+ ) %bc.separator $+  %bc-color2 $+ %bc-percent $+ % $+  %bc-color1 $+ %bc.separator Share Ratio: %bc-color2 $+ %bc-ratio $+  n45= set %bc-dltorrents $calc(%bc-dltorrents - 1) | set %bc-torrentcount $calc(%bc-torrentcount + 1) n46= } n47= set %bc-line $calc(%bc-line + 1) n48= goto show_stats n49= } n50= } n51= n52= if (%bc-ultorrents != 0) { n53= if (%bc-ultorrents = 1) { set %bc-torrent torrent } | else { set %bc-torrent torrents } n54= msg $chan %bc-color1 $+ BitComet is now uploading %bc-color2 $+ %bc-ultorrents $+  %bc-color1 $+ %bc-torrent $+ . n55= n56= set %bc-line 1 | set %bc-torrentcount 1 n57= :show_stats2 n58= if (%bc-ultorrents != 0) { n59= n60= if ((AutoRun="true" isin $read(%bc-location,%bc-line)) && (SeedOnly="true" isin $read(%bc-location,%bc-line))) { n61= set %bc-filesize $gettok($read(%bc-location,%bc-line),%bc-filesize^,34) n62= set %bc-percent $round($calc((1 - $gettok($read(%bc-location,%bc-line),%bc-left^,34) / %bc-filesize) * 100),2) n63= if (%bc-filesize < 1024) { set %bc-filesize $round(%bc-filesize,2) B } | elseif (%bc-filesize < 1048576) { set %bc-filesize $round($calc(%bc-filesize / 1024),2) KB } | elseif (%bc-filesize < 1073741824) { set %bc-filesize $round($calc(%bc-filesize / 1048576),2) MB } | else { set %bc-filesize $round($calc(%bc-filesize / 1073741824),2) GB } n64= set %bc-name $gettok($read(%bc-location,%bc-line),%bc-name^,34) n65= if ($gettok($read(%bc-location,%bc-line),%bc-upload^,34) > 0 && $gettok($read(%bc-location,%bc-line),%bc-download^,34) == 0) { set %bc-ratio Inf. } | else { set %bc-ratio $round($calc($gettok($read(%bc-location,%bc-line),%bc-upload^,34) / $gettok($read(%bc-location,%bc-line),%bc-download^,34)),2) } n66= n67= msg $chan %bc-color1 $+ Torrent %bc-color2 $+ %bc-torrentcount $+ %bc-color1 $+ : %bc-color2 $+ %bc-name $+  %bc-color1 $+ ( $+ %bc-color2 $+ %bc-filesize $+ %bc-color1 $+ ) %bc.separator $+  %bc-color2 $+ %bc-percent $+ % $+  %bc-color1 $+ %bc.separator Share Ratio: %bc-color2 $+ %bc-ratio $+  n68= set %bc-ultorrents $calc(%bc-ultorrents - 1) | set %bc-torrentcount $calc(%bc-torrentcount + 1) n69= } n70= set %bc-line $calc(%bc-line + 1) n71= goto show_stats2 n72= } n73= } n74= :end n75= } n76= } n77= unset %bc-* n78=} n79= n80=Menu Menubar { n81= .BitComet Statistics { dialog -m bcstats bcstats } n82=} n83=Menu Channel { n84= .Show BitComet Stats { bc } n85=} n86= n87=;######################################################## n88=;# Dialog. # n89=;######################################################## n90=dialog bcstats { n91= title BitComet Statistics n92= size -1 -1 336 112 n93= n94= text "Directory:" ,201,14 17 50 15 n95= edit "", 202, 76 14 186 22 n96= button "&Change",200, 271 14 50 23 n97= n98= text "Colours:", 220, 14 48 50 15 n99= edit $tc(1), 223, 76 43 30 23, tab 2 read n100= combo 222, 107 44 80 240, tab 2 size drop n101= edit $tc(2), 226, 210 43 30 23, tab 2 read n102= combo 225, 241 44 80 240, tab 2 size drop n103= n104= text "Separator:", 230, 14 78 50 15 n105= edit "", 233, 76 73 30 23 n106= n107= button "&Done",116, 271 74 50 23,cancel default n108=} n109= n110=;######################################################## n111=;# Dialog Reply. # n112=;######################################################## n113=on *:dialog:bcstats:*:*: { n114= n115= if ($devent == init) { n116= did -b $dname 202 | did -a $dname 202 %bc.location | did -a $dname 233 %bc.separator n117= var %a = 0 n118= while (%a <= 15) { n119= did -a $dname 222,225 $colorcode(%a) n120= inc %a n121= } n122= did -c $dname 222 $calc(%bc.color1 + 1) n123= did -c $dname 225 $calc(%bc.color2 + 1) n124= did -a $dname 223 %bc.color1 n125= did -a $dname 226 %bc.color2 n126= } n127= n128= ;-= BEGIN GUI SCLICK EVENTS =- n129= if ($devent == sclick) { n130= if ($did == 222 || $did == 225) { did -ra $dname $calc($did + 1) $calc($did($did).sel - 1) } n131= if ($did == 200) { if ($did(202) != $null) { did -r $dname 202 | did -a $dname 202 $sdir(%bc.location,Choose) } | else { did -a $dname 202 $sdir(C:\,Choose) } } n132= if ($did == 116) { n133= set %bc.location $did(202) n134= set %bc.color1 $int($did(223)) n135= set %bc.color2 $int($did(226)) n136= set %bc.separator $did(233) n137= } n138= } n139=} n140=;######################################################## n141=;# Color aliases. # n142=;######################################################## n143=alias -l colorcode { return $gettok(White.Black.Blue.Green.Light Red.Brown.Purple.Orange.Yellow.Light Green.Cyan.Light Cyan.Light Blue.Pink.Grey.Light Grey,$calc($1 + 1),$asc(.)) }