mIRC Home    About    Download    Register    News    Help

Print Thread
#135146 08/11/05 02:07 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Don't worry, this is for nothing illegal, it's just for giving out scripts.
Anyway i have 2 problems i hope someone can help me confused

First one is: if i set the the option to advertise to 2 channels and for instance i'm not in one of them it still tries to advertise to the channel i'm not in, then i end up with a flood of #testing No such nick/channel, so i want to stop that but still send the message to the channel i am in, and is set for the advert

Secondly %all_size seems to come out with all the wrong total, if i add 1mb script then say add a 4kb file, i end up with a total of like 5mb, or another time 10kb, i really hope someone can help me with this, it's really stressed me out lol

Code:
 alias announce_packs {
  if ($1 = advertise) {
    var %r = 1
    while (%r <= $lines(system/data/xdcc_advertising.dat)) {
      var %sid = pack_get_id($gettok($read(system/data/xdcc_advertising.dat,%r),2,$asc(º))), %c = $gettok($read(system/data/xdcc_advertising.dat,%r),1,$asc(º))
      if (%sid) {
        scon %sid
        if ($2 = notice) { var %s = notice %c }
        else { var %s =  msg %c }
        if ($setting(xdcc,status) = 0) { %s *** XDCC Server is currently disabled. *** }
        else {
          var %total = $lines(system/data/xdcc.dat), %all_size = ""
          %s *!* XDCC Server is currently enabled *!* 
          %s -
          %s *!* Bandwidth, Current: $currentkbsec $+ , Record: %m016.recbwu 
          %s -
          var %x = 1
          while (%x <= $lines(system/data/xdcc.dat)) {
            var %f = $gettok($read(system/data/xdcc.dat,%x),1,$asc(º)), %k = $bytes($lof(%f),k), %all_size = $calc(%all_size + $bytes($lof(%f),b)), %e = KB
            if ($chr(44) isin %k) { var %k = $bytes($lof(%f),m) | var %e = MB }
            %s  *!* $(#,0) $+ %x $+  $nopath(%f) [ $+ %k $+ %e $+ ] - $gettok($read(system/data/xdcc.dat,%x),2-,$asc(º))
            inc %x
          }
          %s -
          %s *!* Totals, files: %total Size: %all_size $+ %e
          %s -
          %s *!* Currently $xdcc_slots slots open, $setting(xdcc,method) $me XDCC SEND #x
        }
      }
      inc %r
    }
  }
} 

crazy

#135147 08/11/05 02:14 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help ison

if ($me ison $chan) { advertise commands}

As for number 2, if you're adding file sizes, add them in bytes...

//var %size = $calc($file(mirc.hlp).size + $file(mirc.exe).size)

THEN, use $bytes...

//echo -a $bytes(%size).suf


Invision Support
#Invision on irc.irchighway.net
#135148 08/11/05 02:16 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Note that variables allow for simple math expressions, so you don't need $calc in your example:

//var -s %calc = 5 + 6


Gone.
#135149 08/11/05 02:17 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, I know... but I just used that to show the math in case more than one addition was necessary (ie. 3 files). smile

Good to point out to anyone who is new at using /var, though.


Invision Support
#Invision on irc.irchighway.net
#135150 08/11/05 03:40 PM
Joined: May 2005
Posts: 79
M
Babel fish
OP Offline
Babel fish
M
Joined: May 2005
Posts: 79
Thanls guys, all working laugh


Link Copied to Clipboard