mIRC Home    About    Download    Register    News    Help

Print Thread
menu nicklist #210808 26/03/09 01:37 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I made all my popups in the remote section, and now i got a problem with it, i try to explain so you understand
Code:
menu nicklist {
 Test:{ echo -a Test }
 For:{ echo -a For }
 Fun:{ echo -a Fun }
}

; This one working ok, but now i want to hide the the menu nick list (all but some popups that are for the bnc)

menu nicklist {
 $iif($1 == $+($chr(45),psyBNC)):{
 This should show when $1 is $+($chr(45),psyBNC):{ echo -a Query with +psyBNC }
 $iif($1 != $+($chr(45),psyBNC)):{
 ;This should only show if ($1 != $+($chr(45),psyBNC))
 Test:{ echo -a Test }
 For:{ echo -a For }
 Fun:{ echo -a Fun }
}

I don't know why, but if i try to use -psyBNC i get a error, so i need to use $chr(45) for the - sign. How can i get the popup to show like i want it to? been testing a while, but all i get is a error:

* Invalid format: $iif

Someone that know how i can solve this?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: menu nicklist [Re: sparta] #210809 26/03/09 01:58 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
You cannot apply conditions to the menu itself, only conditions to a menuitem. if the condition fails for the item, all subordinated/nested items are affected as well.

If the menuitems aren't nested under a common item, you have to add your condition to every item:
Code:
menu nicklist {
  $iif($1 == $+($chr(45),psyBNC),nick is $+($chr(45),psyBNC)) : { echo -a Query with +psyBNC }
  $iif($1 != $+($chr(45),psyBNC),Test) : { echo -a Test }
  $iif($1 != $+($chr(45),psyBNC),For) : { echo -a For }
  $iif($1 != $+($chr(45),psyBNC),Fun) : { echo -a Fun }
}

If the menuitems would be nested under a common menuitem, you can apply the condition to this superordinate item, thereby disabling/enabling all menuitems nested under it. You could simply add one "tree" for true, and another one for false:
Code:
menu nicklist {
  $iif($1 == $+($chr(45),psyBNC),psyBNC)
  .nick is $+($chr(45),psyBNC) : { echo -a Query with +psyBNC }
  $iif($1 != $+($chr(45),psyBNC),psyBNC)
  .Test : { echo -a Test }
  .For : { echo -a For }
  .Fun : { echo -a Fun }
}


...or you use a submenu that is only triggered by the $iif condition

Finally, if there's no nesting under a common item, you could use the fact that popups are processed in linear order, e.g.:
Code:
; dummy menu item that calls the custom identifier "nicklistswitch"
menu nicklist {
  $nicklistswitch($iif($1 != $+($chr(45),psyBNC),.enable,.disable)) 
}

; the custom identifier - returning nothing (thus the dummy menu won't show) but switching the group
alias -l nicklistswitch { $1 #nopsyBNC }

; this popup will only show if the condition of the dummy menu item was met
#nopsyBNC off
menu nicklist {
  Test : echo -a Test
  For : echo -a For
  Fun : echo -a Fun
}
#nopsyBNC end
...and you don't need to add the condition to all the items separately smile

Last edited by Horstl; 26/03/09 02:34 PM.