mIRC Homepage
Posted By: Horstl Submenu behaviour - 02/06/08 06:12 AM
I recently run into this (just an example code):
Code:
menu channel {
  test
  .$submenu($test($1,$active))
}

alias -l test {
  if (($1 isnum) && ($nick($2,$1))) { return Nr. $1 = $nick($2,$v1).pnick : noop }
}

The submenu return double-evaluates, thus if you have halfops in a channel (pnick starting with a % char), treating %nick like a variable (likely resulting in an empty return), and &nick (protected ops) are hotkeyed due to the & char...

Interesting: change the return command to e.g.:
Code:
if (($1 isnum) && ($nick($2,$1))) { $nick($2,$v1).pnick = Nr. $1 : noop }
...and you'll see mIRCs "internal syntax morphing" of
"%bla = value" to "set %bla value"

I'd like to know how to *correctly* reduce evaluation depth in $submenus (for the moment, I'm just preventing it by adding a char: $+($chr(160),$nick($2,$1).pnick) - this is working only for %pnick but not &pnick), and in addition, I'd appreciate an explanation for why this double evaluation in submenus is necessarry.

Thanks!
Posted By: Horstl Re: Submenu behaviour - 02/06/08 04:12 PM
...too late to edit: I missed "return" in the second piece of code, right after the opening {-bracket
Posted By: Wims Re: Submenu behaviour - 02/06/08 04:50 PM
I found something that work, but i found this behavior really annoying too :

Code:
   if (($1 isnum) && ($nick($2,$1))) { var -s %a $replace($nick($2,$v1).pnick,%,$+([,$chr(15)%,]),&,&&) | return Nr. $1 = $!replacex( %a ,$+([,$chr(15),]),%) : noop }

© mIRC Discussion Forums