mIRC Homepage
Posted By: Daveoh Nick list menu $1- not returned properly - 01/03/09 06:46 PM
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.
Posted By: Horstl Re: Nick list menu $1- not returned properly - 01/03/09 07:54 PM
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)
Posted By: RusselB Re: Nick list menu $1- not returned properly - 01/03/09 07:55 PM
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
}

Posted By: Daveoh Re: Nick list menu $1- not returned properly - 01/03/09 08:20 PM
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.
Posted By: RusselB Re: Nick list menu $1- not returned properly - 01/03/09 09:07 PM
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.
Posted By: qwerty Re: Nick list menu $1- not returned properly - 01/03/09 09:25 PM
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...
Posted By: Daveoh Re: Nick list menu $1- not returned properly - 01/03/09 11:10 PM
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.
© mIRC Discussion Forums