mIRC Home    About    Download    Register    News    Help

Print Thread
#4222 31/12/02 01:23 PM
P
PHMinistries
PHMinistries
P
is there a way to write an alias to deop in all rooms that your in?

Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
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>

Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
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?

P
PHMinistries
PHMinistries
P
to deop myself

Joined: Dec 2002
Posts: 143
G
Vogon poet
Offline
Vogon poet
G
Joined: Dec 2002
Posts: 143
Deop me: {
var %i = 1
while (%i <= $chan(0)) {
if ($me isop $chan(%i)) mode $chan(%i) -o $me
inc %i
}
}

P
PHMinistries
PHMinistries
P
mucho thankso smile

Joined: Dec 2002
Posts: 143
G
Vogon poet
Offline
Vogon poet
G
Joined: Dec 2002
Posts: 143
You're welcome smile

Joined: Dec 2002
Posts: 1,253
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,253
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


Link Copied to Clipboard