Percent of channels with modes

By sunslayer on Dec 30, 2009

havn't done anything in msl for a while and as far as i know this is the only snippet that serves this purpose, i.e. searches all channels outputted by the /list cmd that modes match the given.

syntax:

/chmodes [+-](modes) [search params]

the +/- is optional, if u specify - it returns the number of channels without the modes, else it defaults to +(number of channels with the modes)

modes is the modes that you are searching for, if you are searching for multple modes they must match EXACTLY to the modes that are outputted by /list, abc isn't the same as cba

search params is the normal params u would use with /list, for help with that /helpop ?list

atm i cant figure out how to stop the Channels List window from opening, but its not really that big of a deal, the snippet will just echo the info in the channel that u typed the cmd in until i can get the window to stop opening.

alias chmodes {
  if ($regex($1,/(?(?=[+-])\w|(\w+))/)) {
    .enable #list
    var -g %list.chan = $active,%list.mode = $regml(1),%list.neg = $iif($left($1,1) == -,$true,$false)
    .raw list $2-
  }
}
#list off
raw 321:*:haltdef
raw 322:*: {
  .noop $regex($1-,/.*? #.*? (\d+) (?:\[\+(.*?)].*)?/)
  inc %list.total
  $iif(%list.mode isin $regml(2),inc %list.match,inc %list.nomatch)
  haltdef
}
raw 323:*:{
  haltdef
  var %list.match = $iif(%list.neg,%list.nomatch,%list.match),%list.sign = $iif(%list.neg,-,+)
  echo %list.chan %list.total channels found, $iif(%list.match,$v1,0) channel(s) have mode $+(%list.sign,%list.mode,$chr(44)) or $round($calc((%list.match / %list.total )*100),2) $+ %
  unset %list.*
  .disable #list
}
#list end

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.