mIRC Home    About    Download    Register    News    Help

Print Thread
#200307 02/06/08 06:12 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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!

Joined: Nov 2006
Posts: 1,559
H
Horstl Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
...too late to edit: I missed "return" in the second piece of code, right after the opening {-bracket

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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 }


Last edited by Wims; 02/06/08 04:55 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard