mIRC Homepage
Posted By: HaleyJ Alias help - 27/10/06 12:23 AM
I am having trouble with this if someone can advise and show me where i am going wrong it will be much appreciated

Code:
 /allchans {
  var %i = 1
  while (%i <= $chan(0)) {
    if ($me !isop $chan(%i)) {
      os mode $chan(%i) +o $me | mode $chan(%i) + $+ $1
    }
    inc %i
  }
}
 


it just keeps on crashing
Posted By: RusselB Re: Alias help - 27/10/06 01:13 AM
You are usiing a valid entry for $1, I hope. If not, then that might be your problem.

Since you've done such a good job on this, I'm going to presume that you know it has to go in the Aliases section as is, or Remotes changing /allchans { to alias allchans {
Posted By: HaleyJ Re: Alias help - 27/10/06 01:25 AM
Hi
Yes its in my aliases section and i am using a valid entry. It just crashes my client though and i always have to Ctrl + break out of it i have no idea what maybe causing it.
Posted By: HaleyJ Re: Alias help - 27/10/06 01:31 AM
hi
I realised my mistake i was doing /allchans +i when i should have been doing /allchans i as i put a + in my script already.
I still have a problem though its only doing one channel and not all the channels that i am in.
Posted By: HaleyJ Re: Alias help - 27/10/06 02:01 AM
If i take away the IF statement it works. But i see no reason why i should have to do that. can anyone shed any light on this for me?
Posted By: deegee Re: Alias help - 27/10/06 02:45 AM
You have both actions set for chans where you are not opped, is that what you want?
Code:
allchans {
  var %i = 1
  while ($chan(%i)) {
    if ($me !isop $v1) { os mode $v2 +o $me | mode $v2 + $+ $1 }
    inc %i
  }
}

Or for the mode change to act on all chans
Code:
allchans {
  var %i = 1
  while ($chan(%i)) {
    if ($me !isop $v1) { os mode $v2 +o $me }
    mode $v2 + $+ $1
    inc %i
  }
}
Posted By: HaleyJ Re: Alias help - 27/10/06 12:17 PM
deegee thanks for that. Its still not working. When i am not opped it ops me on all channels but does the mode setting on only ONE channel
Posted By: Bullseye Re: Alias help - 27/10/06 06:47 PM
mirc itsels has a nice thing called perform you can set all kinds of settings there.
Just put a op command inthere with every channel you have op acces to.
Posted By: MikeChat Re: Alias help - 27/10/06 07:50 PM
I think this will work for you
Code:
allchans {
  var %i = 1
  var %c = $chan(0)
  while (%i <= %c) {
    if ($1 isreg $chan(%i)) {
      if ($me !isop $chan(%i)) {
        os mode $chan(%i) +o $me
        .timerdelay 1 1 mode $chan(%i) + $+ $1
      }
      elseif ($me isop) { mode $chan(%i) + $+ $1 }
    }
    inc %i
  }
}


BTW is that meant to be os or Cs
Posted By: HaleyJ Re: Alias help - 27/10/06 09:23 PM
Hi
Thanks alot for that and i will try it out. This script i wanted to use operserv as i dont have chanserv access to each channel.
i had meanwhile made some sort of fix where it worked but your solution looks alot better.
Thanks again
Posted By: MikeChat Re: Alias help - 27/10/06 10:06 PM
as i sit here looking at this, isnt there a parameter missing?

mode $chan(%i) + $+ $1 $2

or

mode $chan(%i) + $+ $1-

/allchan i mike

without the $2 its /mode #channel +i
ie nothing to do
Posted By: HaleyJ Re: Alias help - 28/10/06 09:28 PM
nope mike not working frown i am try ing to set channel modes; all channels i am not op on operserv will op me and set the channel mode. All channels i AM op on it will just set the mode.
Posted By: MikeChat Re: Alias help - 29/10/06 12:33 AM
evidently I cant see my own } errors
try this
Code:
allchans {
  var %i = 1
  var %c = $chan(0)
  while (%i <= %c) {
    if ($me !isop $chan(%i)) {
      os mode $chan(%i) +o $me
      .timerdelay 1 3 mode $chan(%i) $1-
    }
    else { 
      mode $chan(%i) $1- 
    }
    inc %i
  }
}


to change channel mode:
/allchans (+/-)mode
fex: /allchans +nt-R

to op a nick in all channels you are in (doesnt check for $comchannel)
/allchans (+/-) mode Nick
fex: /allchans +o superman
© mIRC Discussion Forums