mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 60
S
Babel fish
OP Offline
Babel fish
S
Joined: Aug 2006
Posts: 60
I always get "* Invalid format: $address (line x, aliases.ini)" - x is whichever line the appropriate $address is on - when I try to use this /ban alias. What's causing this error and how do I fix it? Fell free to improve anything else in this smile
Code:
ban {
  ;ban [-ejknqruN] [#channel] nickname [type]
  ;I haven't looked at the -(u)ek and -(u)rk combos yet
  ;Will not work for more than 4 type j, or otherwise more than 12 nicks
  if ($left($1,1) == $chr(45)) {

    ;there is a switch
    if (*u* iswmcs $1) {
      ;To take the uN off the end
      var %notuswitches = $gettok($1,1,117)
      ;To get the time to unban out
      var %unban = $gettok($1,2,117) 
      if (*k* iswmcs $1) {    
        ;To take the k out
        var %notkswitches = $gettok(%notuswitches,1,107) $+ $gettok(%notuswitches,2,107)
      }
      if (*r* !iswmcs $1) {
        ;To put the r in
        var %laterswitches = -r $+ $gettok(%notkswitches,1,45)
      }
      else {
        ;To take the r out, ie remove a ban/except now, then put it back later
        var %laterswitches = - $+ $gettok(%notkswitches,1,114) $+ $gettok(%notkswitches,2,114)
      }
      ;To undo the immediate thing
      .timer 1 %unban ban %laterswitches $2-
    }
    if (*e* iswmcs $1) {
      ;Adding/removing exceptions
      var %mainmode = e
      var %minormode = b
    }
    else {
      ;Adding/removing bans
      ;These settings by default
      var %mainmode = b
      var %minormode = e
    }
    if (*r* iswmcs $1) {
      ;removing exceptions/bans
      var %exceptsign = +
      var %bansign = -
    }
    else {
      ;adding exceptions/bans
      ;These settings by default
      var %exceptsign = -
      var %bansign = +
    }
    if ($left($2,1) == $chr(35)) {

      ;there is a channel
      if ($calc($4) != 0) {

        ;there is a bantype
        var %chans = $2, %nicks = $3, %bantype = $4, %reason = $5-
        if (*j* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          while (%counter <= %total) {
            var %nick = $gettok(%nicks,%counter,58)
            var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode 
            var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*n* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          var %extban = ~n:
          while (%counter <= %total) {
            var %nick = $gettok(%nicks,%counter,58)
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*q* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          var %extban ~q:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*j* !iswmcs $1) { 
          if (*n* !iswmcs $1) { 
            if (*q* !iswmcs $1) {
              var %total = $numtok(%nicks,58)
              var %counter = 1
              while (%counter <= %total) {
                var %modes = %modes $+ %bansign $+ %mainmode 
                var %nick = $gettok(%nicks,%counter,58)
                var %params = %params $address(%nick,%bantype)
                inc %counter
              }
            }
          }
        }
      }
      else {

        ;there is not a bantype
        var %chans = $2, %nicks = $3, %bantype = 2, %reason = $4-
        if (*j* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          while (%counter <= %total) {
            var %nick = $gettok(%nicks,%counter,58)
            var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode 
            var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
            inc %counter
          }
        } 
        if (*n* iswmcs $1) {
          var %total $numtok(%nicks,58)
          var %counter = 1
          var %extban = ~n:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*q* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          var %extban = ~q:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*j* !iswmcs $1) { 
          if (*n* !iswmcs $1) { 
            if (*q* !iswmcs $1) {
              var %total = $numtok(%nicks,58)
              var %counter = 1
              while (%counter <= %total) {
                var %modes = %modes $+ %bansign $+ %mainmode 
                var %nick = $gettok(%nicks,%counter,58)
                var %params = %params $address(%nick,%bantype)
                inc %counter
              }
            }
          }
        }
      }
    }
    else {

      ;there is not a channel
      if ($calc($3) != 0) {

        ;there is a bantype
        var %chans = $chan, %nicks = $2, %bantype = $3, %reason = $4-
        if (*j* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          while (%counter <= %total) {
            var %nick = $gettok(%nicks,%counter,58)
            var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode 
            var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
            inc %counter
          } 
        }
        if (*n* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1, %bantype = $3, %extban ~n:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*q* iswmcs $1) {
          var %total $numtok(%nicks,58)
          var %counter = 1, %bantype = $3, %extban = ~q:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*j* !iswmcs $1) { 
          if (*n* !iswmcs $1) { 
            if (*q* !iswmcs $1) {
              var %total = $numtok(%nicks,58), %counter = 1, %bantype = $3
              while (%counter <= %total) {
                var %modes = %modes $+ %bansign $+ %mainmode 
                var %nick = $gettok(%nicks,%counter,58)
                var %params = %params $address(%nick,%bantype)
                inc %counter
              }
            }
          }
        }
      }
      else {

        ;there is not a bantype
        var %chans = $chan, %nicks = $2, %bantype = 2, %reason = $3-
        if (*j* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1
          while (%counter <= %total) {
            var %nick = $gettok(%nicks,%counter,58)
            var %modes = %modes $+ %bansign $+ %mainmode $+ %minormode $+ %minormode 
            var %params = %params $address(%nick,%bantype) ~n: $+ $address(%nick,%bantype) ~q: $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*n* iswmcs $1) {
          var %total $numtok(%nicks,58)
          var %counter = 1, %extban ~n:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*q* iswmcs $1) {
          var %total = $numtok(%nicks,58)
          var %counter = 1, %extban = ~q:
          while (%counter <= %total) {
            var %modes = %modes $+ %bansign $+ %mainmode 
            var %nick = $gettok(%nicks,%counter,58)
            var %params = %params %extban $+ $address(%nick,%bantype)
            inc %counter
          }
        }
        if (*j* !iswmcs $1) { 
          if (*n* !iswmcs $1) { 
            if (*q* !iswmcs $1) {
              var %total = $numtok(%nicks,58)
              var %counter = 1
              while (%counter <= %total) {
                var %modes = %modes $+ %bansign $+ %mainmode 
                var %nick = $gettok(%nicks,%counter,58)
                var %params = %params $address(%nick,%bantype)
                inc %counter
              }
            }
          }
        }
      }
    }
  }
  else {
    ;there is not a switch
    var %mainmode = b, %minormode = e, %exceptsign = -, %bansign = +
    if ($left($1,1) == $chr(35)) {

      ;there is a channel
      if ($calc($3) != 0) {

        ;there is a bantype
        var %chans = $1, %nicks = $2, %bantype = $3
        var %total = $numtok(%nicks,58)
        var %counter = 1
        while (%counter <= %total) {
          var %modes = %modes $+ %bansign $+ %mainmode 
          var %nick = $gettok(%nicks,%counter,58)
          var %params = %params $address(%nick,%bantype)
          inc %counter
        }
      }
      else {

        ;there is not a bantype
        var %chans = $1, %nicks = $2, %bantype = 2
        var %total = $numtok(%nicks,58)
        var %counter = 1
        while (%counter <= %total) {
          var %modes = %modes $+ %bansign $+ %mainmode 
          var %nick = $gettok(%nicks,%counter,58)
          var %params = %params $address(%nick,%bantype)
          inc %counter
        }
      }
    }
    else {

      ;there is not a channel
      if ($calc($2) != 0) {

        ;there is a bantype
        var %chans = $chan, %nicks = $1, %bantype = $2
        var %total = $numtok(%nicks,58)
        var %counter = 1
        while (%counter <= %total) {
          var %modes %modes $+ %bansign $+ %mainmode 
          var %nick = $gettok(%nicks,%counter,58)
          var %params = %params $address(%nick,%bantype)
          inc %counter
        }
      }
      else {

        ;there is not a bantype
        var %chans = $chan, %nicks = $1, %bantype = 2
        var %total = $numtok(%nicks,58)
        var %counter = 1
        while (%counter <= %total) {
          var %modes = %modes $+ %bansign $+ %mainmode 
          var %nick = $gettok(%nicks,%counter,58)
          var %params = %params $address(%nick,%bantype)
          inc %counter
        }
      }
    }
  }
  mode %chans %modes %params
  if ($left($1,1) == $chr(45)) {
    ;If there is a switch
    if (*k* iswmcs $1) kick %chans %nicks %reason
  }
}

kick {
  ;seperate targets with a :
  var %kick.chan.total $numtok($1,58)
  var %kick.nick.total $numtok($2,58)
  var %kick.nick.counter 1
  while (%kick.nick.counter <= %kick.nick.total) {
    var %kick.chan.counter 1
    while (%kick.chan.counter <= %kick.chan.total) {
      kick $gettok($1,%kick.chan.counter,58) $gettok($2,%kick.nick.counter,58) $iif($3,$3-,15Scatter 14...13Senbonzakura!)
      inc %kick.chan.counter
    }
    inc %kick.nick.counter
  }
}
mode {
  ;seperate targets with a :
  var %mode.chan.total $numtok($1,58)
  var %mode.chan.counter 1
  while (%mode.chan.counter <= %mode.chan.total) {
    mode $gettok($1,%mode.chan.counter,58) $2-
    inc %mode.chan.counter
  }
}

Thanks for your help!

EDIT: Added the necessary = signs, which has fixed the problem.

Last edited by Shining_Phoenix; 17/03/07 11:49 AM.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Use the = sign in your /var commands (as documented) and the problem will go away.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2006
Posts: 60
S
Babel fish
OP Offline
Babel fish
S
Joined: Aug 2006
Posts: 60
Thanks, that did fix my problem smile


Link Copied to Clipboard