mIRC Homepage
Posted By: PHMinistries deoping in all rooms at once - 31/12/02 01:23 PM
is there a way to write an alias to deop in all rooms that your in?
Posted By: Collective Re: deoping in all rooms at once - 31/12/02 01:29 PM
alias adeop {
var %temp = 1
while ( $comchan($$1,%temp) ) {
if ( $me isop $comchan($$1,%temp) ) && ( $$1 isop $comchan($$1,%temp) ) {
mode $comchan($$1,%temp) -o $$1
}
inc %temp
}
}

Usage: /adeop <nick>
Posted By: Dana Re: deoping in all rooms at once - 31/12/02 04:13 PM
Did you want a way to deop yourself in all channels that you're in or did you want to deop somebody else in all common channels that you're in?
Posted By: PHMinistries Re: deoping in all rooms at once - 31/12/02 04:24 PM
to deop myself
Posted By: gemeau50 Re: deoping in all rooms at once - 31/12/02 04:51 PM
Deop me: {
var %i = 1
while (%i <= $chan(0)) {
if ($me isop $chan(%i)) mode $chan(%i) -o $me
inc %i
}
}
Posted By: PHMinistries Re: deoping in all rooms at once - 31/12/02 05:44 PM
mucho thankso smile
Posted By: gemeau50 Re: deoping in all rooms at once - 31/12/02 06:46 PM
You're welcome smile
Posted By: Hammer Re: deoping in all rooms at once - 31/12/02 08:00 PM
Here's what I use:
Code:

alias deopme {
  if ($1 == -a) {
    var %activecid = $activecid
    var %active = $iif($numtok($active,32) &gt; 1,$+(",$active,"),$active)
    var %n = 1
    while ($scon(%n)) {
      scon %n
      var %s, %c = 1
      while ($chan(%c)) {
        if ($me isop $ifmatch) {
          if ($len(%s) &gt; 0) %s = $+(%s,$crlf,MODE $chan(%c) -o $me)
          else %s = MODE $chan(%c) -o $me
        }
        inc %c
      }
      .raw %s
      inc %n
    }
    scid %activecid
    window -a %active
  }
  elseif ($1 == -n) {
    var %s, %c = 1
    while ($chan(%c)) {
      if ($me isop $ifmatch) {
        if ($len(%s) &gt; 0) %s = $+(%s,$crlf,MODE $chan(%c) -o $me)
        else %s = MODE $chan(%c) -o $me
      }
      inc %c
    }
    .raw %s
  }
  elseif ($me isop #$1) .raw MODE #$1 -o $me
  elseif (!$1) &amp;&amp; (((#* iswm $active) &amp;&amp; ($me isop $active))) .raw MODE $active -o $me
  elseif (($1 == ?) || ((!$1) &amp;&amp; (#* !iswm $active))) {
    linesep -a
    echo $color(info) -ati2 * /DEOPME [-a|-n|[#]channel]
    echo $color(info) -ati2 * Deops you on channels where you are opped
    linesep -a
    echo $color(info2) -ati2 /deopme -a     -a(ll) deops you in all channels on all networks
    echo $color(info2) -ati2 /deopme -n     -n(etwork) deops you in all channels on the current network
    echo $color(info2) -ati2 /deopme #mIRC  deops you in #mIRC on this network only
    echo $color(info2) -ati2 /deopme mIRC   deops you in #mIRC on this network only
    echo $color(info2) -ati2 /deopme ?      brings up this help info
    echo $color(info2) -ati2 /deopme        - in a channel window, deops you
    echo $color(info2) -ati2                - in a non-channel window, brings up this help info
    linesep -a
  }
}

I hope you find this useful, both as an exercise in scripting for multiple networks and for general scripting. cool
© mIRC Discussion Forums