mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2004
Posts: 54
Z
Zed Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Mar 2004
Posts: 54
I have found a solution to toggle the display of a contextual submenu (eg: nicklist,channel).

Code:
alias -l enamnu { .enable #mnu | .timer 1 0 .disable #mnu }

menu nicklist,channel {
  $iif( (test if submenu should be displayed) ,$enamnu)
}

#mnu off
menu nicklist,channel {
  Submenu name
  .$submenu(...)
  ...
}
#mnu end


It works perfectly. The reason to do this is to prevent mirc from calling the $submenu alias which is time consuming in this particular case.

Do you see any disadvantage in using enable/disable?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I don't - sometimes I use this method too smile
A group is useful as well if you have several unnested items and don't want to put the same $iif() each

Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Here's one that I use for my warn/kick/ban script. It's essentially the same, just separating the code from the menu slightly so the menu is slightly less ugly to look at.
Code:
menu nicklist {
  $GetWBLabel([F8] Inappropriate Nickname,0): F8
  $GetWKBLabel([F9] General Disturbance,1): F9
  $GetWKBLabel([F10] Harassment,2): F10
  $GetWKBLabel([F11] Auto Message,3): F11
  $GetWKBLabel([F12] Spam,4): F12
}

alias GetWKBLabel {
  if ($hget(WKB_Chan,$chan) != $null) {
    return $1 $GetWKBList($calc($v1 + $2),$false,$!BeautifyWKBList(%warn,%kick,%ban))
  }
}

Last edited by s00p; 18/01/10 02:09 PM.

Link Copied to Clipboard