mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 32
Daveoh Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Feb 2006
Posts: 32
I was just trying to disable a menu item based on whether $2 exists or not and it was found that $2- doesn't exist in the menu item text although multiple nicks have been selected:
Code:
menu nicklist {
  $iif($2 != $null,$style(2)) EWhois:whois $1 $1
}
Try this yourself by selecting multiple nicks and then checking the menu.
By entering $1- into a custom alias within the $iif (e.g. $iif($check($2),...)) you can echo the input to see only $1 is returned.

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
While the returned values are like expected if used in the command part, $N indeed returns "unexpected" values if used in the menuitem definition:
Code:
menu nicklist,channel {
  Test (selected $snick(#,0) nicks)
  .$ $+ 0 = $0 : echo -ag $ $+ 0 = $0
  .$ $+ 1 = $1 : echo -ag $ $+ 1 = $1
  .$ $+ 2 = $2 : echo -ag $ $+ 2 = $2
}
- If no nick is selected, shows "$0 = 1" but echoes "$0 = 0"
- If two nicks are selected, shows "$0 = 1" but echoes "$0 = 2"
- If two nicks are selected, it shows "$2 =" but echoes "$2 = <2nd selected nick>"

The examples of the helpfile don't use $N in the menuitem definition at all, and I'm not sure what the "correct" behaviour is: $N's in the menuitem definition are used in $submenu calls, maybe that's why $0 is evaluated to 1 and $2 is empty.

To fix your particular script, use:
$snicks (a comma-delimited string of all selected nicknames of the active channel)
$snick(#,N) (the Nth selected nick of channel #; if N = 0 the total number of selected nicks. If you dont specify N it returns a string like $snicks)

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
When selecting multiple nicks, you can return the list using $snicks
This returns a comma separated list, which means the entire list is part of $1
To see if more than one nick was selected, use $snick(#channel,N) where N is the number of the selected nick.
eg: $snick(#channel,1) returns the first nick selected
$snick(#channel,4) returns the fourth nick selected (or $null if there isn't a fourth selected nick)

$2 would not be filled until a space character was encountered.

Code:
menu nicklist {
  $iif($snick($chan,2),$style(2)) EWhois: whois $1 $1
}


Joined: Feb 2006
Posts: 32
Daveoh Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Feb 2006
Posts: 32
I wasn't asking for an alternative method since I already have it (using $snicks as you said), I was just pointing out that it's not working as expected and is presumably a bug and hopefully gets fixed. Thanks anyhow.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In case I wasn't clear, $2 (and above) are automatically filled when the items are space separated (delimited).
Selecting multiple nicks in the nicklist puts the items into a comma separated (delimited) list, thus $2- is not filled.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
If that were the case, $1 would be "nick1,nick2,...." but it's not - it's just "nick1". Also, your theory doesn't really fit with the fact that $1- in the command part works as expected...


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2006
Posts: 32
Daveoh Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Feb 2006
Posts: 32
The nicks are NOT comma delimited when selected as you can easily check with an item echoing $1-. $snicks is comma delimited but this is not in the tokens $1-. Therefore $1- does NOT work as expected in the item name which is also made clear in the second post. This is not a bug about $snicks so $snicks should stop being discussed.


Link Copied to Clipboard