mIRC Homepage

menu nicklist and $0 etc

Posted By: Wims

menu nicklist and $0 etc - 01/11/11 01:05 AM

Consider this:
Code:
menu nicklist {
  $qt($0) - $qt($1-) : echo -a $0 -- $qt($1-) -- $qt($sline($active,1)) -- $qt($snicks)
}
If nothing is selected in the nicklist, right clicking an empty area of the nicklist trigger the menu but:
-the value of $0 is 1 when the menu is displayed while $1 is $null
-the value is correctly set to 0 when you execute the command.

Same problem occurs if you select more than one (let's say 2) nickname and then rightclick on one of them, the value of $0 is 1 and only $1 exists before executing the command, after, values are correct.
Posted By: Horstl

Re: menu nicklist and $0 etc - 01/11/11 01:59 AM

An old issue - and I'm still not sure whether it can fittingly be fixed if it really turns out to be a side-effect of $submenu.
I hope Khaled will shed some light on it this time. smile
Posted By: jaytea

Re: menu nicklist and $0 etc - 02/11/11 07:22 AM

i wouldn't think this is related to $submenu(), since $submenu() is just evaluated in a separate environment where $0 = 1 and $1 = begin, 1, 2, 3, ..., end, similar to (but slightly less complicated than) how $findfile()'s command parameter is evaluated with $1- = filename. see:

Code:
//tokenize 32 a b c | echo -a $submenu($iif($1 <= 10, a:b)) - $0 - $1-


so 10 popups are returned to $submenu(), $1 takes on a number of different values throughout, but these don't interfere with the values of $Ns in the caller. in cases where $submenu() isn't used, there is even less reason to believe it may be the culprit ;P

it looks as though Khaled has just chosen to stop collecting selected nicks after the first one, in the popup creation stage at least. my first thought was that it's a matter of efficiency, and that perhaps with the way popups have been implemented, it would involve a loop through all selected nicks for each and every line in nicklist popups. however, it seems this isn't the case, and that the selected nick is presently collected just once at the very beginning:

Code:
menu nicklist {
  Test $1:/
  Test $iif((1) sline # 2,):/
  Test $1:/
}


so i don't see why this would be a difficult change to make
Posted By: Horstl

Re: menu nicklist and $0 etc - 04/11/11 01:02 AM

Hmm, plausible. smile
Posted By: Khaled

Re: menu nicklist and $0 etc - 13/11/11 12:18 PM

Thanks the first issue with $0 returning 1 when no item is selected has been fixed for the next version. The second issue is intended - only one item is returned when building the menu - otherwise if a user selects a hundred nicknames you will end up with a menu that does not fit on the screen.
Posted By: sparta

Re: menu nicklist and $0 etc - 13/11/11 07:01 PM

Maybe add a "halt" after 5 or 10 users? just a idea smile
Posted By: Wims

Re: menu nicklist and $0 etc - 13/11/11 07:25 PM

I don't really get it, the number of nickname selected doesn't affect the size of the popups, not directly at least.
If this is about preventing us from using (for example) $1- because it might be a very long string, there's already a limit on the maximum number of characters allowed in the popups (~260 characters here on win7), we wouldn't be able to make a popups that doesn't fit on the screen.
Posted By: Khaled

Re: menu nicklist and $0 etc - 13/11/11 09:50 PM

This feature has worked this way for a very long time, so there are no plans to change it as it would affect all existing scripts. I also just tested this under Windows XP and 7 and I was able to create a popup menu that covered the whole screen and beyond.
© 2020 mIRC Discussion Forums