mIRC Home    About    Download    Register    News    Help

Print Thread
#249560 05/12/14 03:53 AM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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
  }
}


JuanAm #249562 05/12/14 04:06 AM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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) { 

}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #249563 05/12/14 04:21 AM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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?

JuanAm #249564 05/12/14 04:56 AM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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
  }
}

Last edited by Wims; 05/12/14 05:25 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #249565 05/12/14 05:08 AM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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)


JuanAm #249566 05/12/14 05:25 AM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I edited!


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #249567 05/12/14 05:30 AM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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.


Link Copied to Clipboard