mIRC Homepage
Posted By: JuanAm Help alias - 05/12/14 03:53 AM
This alias is to leave (part) all channels that have +u mode includes in their modes.
Do not work the comparator.
I've done wrong?
Code:
alias modeu {
  var %m = $chan(0)
  while ( %m > 0 ) {
    if ($me ison $chan(%m)) && ($chan($chan).mode isin u) {
      .part $chan(%m)
    }
    dec %m
  }
}

Posted By: Wims Re: Help alias - 05/12/14 04:06 AM
Lol, because you got the condition backward:

(+unrSt isin u) will never be true for example, even (+u isin u) would never be true. Use:
Code:
if (u isin $chan($chan).mode) { 

}
Posted By: JuanAm Re: Help alias - 05/12/14 04:21 AM
Your code work only to exit (part) the channel where I execute the command.

I want to leave all channels that have u mode, for that reason I made the alias, to check the channels I meet, and then comparing whether any of them has the mode u.

How is the complete code to work?
Posted By: Wims Re: Help alias - 05/12/14 04:56 AM
I was just pointing out you had the operand backward inside the condition:

if (v1 isin v2)
isn't the same as
if (v2 isin v1)

You also had a typo where $chan was used instead of $chan(%m), I used $comchan to avoid the check with 'ison' and rearranged the loop to get the script smaller:

Code:
alias modeu {
  var %m 1
  while ($comchan($me,%m)) {
    if (u isincs $chan($v1).mode) part $comchan($me,%m)
    inc %m
  }
}
Posted By: JuanAm Re: Help alias - 05/12/14 05:08 AM
Originally Posted By: Wims
I was just pointing out you had the operand backward inside the condition:

if (v1 isin v2)
isn't the same as
if (v2 isin v1)

You also had a typo where $chan was used instead of $chan(%m), I used $comchan to avoid the check with 'ison' and rearranged the loop to get the script smaller:

Code:
alias modeu {
  var %m 1
  while ($comchan($me,%m)) {
    if (u isincs $chan($v1).mode) part $comchan(%m)
    inc %m
  }
}


Error: * Too few parameters: $comchan

The line error is:
Code:
if (u isincs $chan($v1).mode) part $comchan(%m)

Posted By: Wims Re: Help alias - 05/12/14 05:25 AM
I edited!
Posted By: JuanAm Re: Help alias - 05/12/14 05:30 AM
Originally Posted By: Wims
I edited!


I had already fix the previous bug, before seeing the edited post.

Code:
 if (u isincs $chan($v1).mode) part $comchan($me,%m)


I was answering when you answered me.
Thanks for your help.
© mIRC Discussion Forums