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?
alias modeu {
var %m = $chan(0)
while ( %m > 0 ) {
if ($me ison $chan(%m)) && ($chan($chan).mode isin u) {
.part $chan(%m)
}
dec %m
}
}
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:
if (u isin $chan($chan).mode) {
}
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?
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:
alias modeu {
var %m 1
while ($comchan($me,%m)) {
if (u isincs $chan($v1).mode) part $comchan($me,%m)
inc %m
}
}
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:
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:if (u isincs $chan($v1).mode) part $comchan(%m)
I had already fix the previous bug, before seeing the edited post.
if (u isincs $chan($v1).mode) part $comchan($me,%m)
I was answering when you answered me.
Thanks for your help.