mIRC Homepage
Posted By: westor $menu - help! - 22/06/09 02:00 PM
Hello,

I made an add-on and i've added setting about the MENUS that the add-on works, i am trying to find a way to make this but i can't, can anyone help?

Code:
menu * {
  $iif($gettok(%menu,$findtok(%menu,$menu,44),44) == $menu)) {
    ; %menu = menubar,status
    -
    .Enable the add-on:set %add-on on
  }
}
Posted By: Horstl Re: $menu - help! - 22/06/09 02:34 PM
What the heck are you trying to do?

- iif-syntax is: $iif(<condition>,<stuff for true>[,stuff for false]) - there are no curly brackets. Not that I have an idea what your condition is up to...
- if an $iif will make a menuitem appear only in this or that case, all the menuitems nested under this item are affected as well. You can't use curly brackets to "group" them. You can use curly brackets only in the command part of a menuitem.
- you cannot nest (.) under a separator "-". It's not really an item.
Posted By: argv0 Re: $menu - help! - 22/06/09 02:37 PM
If you're trying to add the same check for multiple menu items you need to have the $iif check on every item individually (even separators). The only time you don't need it is for child elements, ie:

$iif(C,T,F)
.Child item:....

^ "Child item" above does not need the if, it will be conditionally available through the parent item if only if the parent item is.
Posted By: westor Re: $menu - help! - 22/06/09 02:47 PM
I am trying to make that when the if (%menu == Status) or if %menu == channel to see this menu. any idea how can i make this ?

note: if i ware an expert i would not came here to ask . mr Horstl
Posted By: Horstl Re: $menu - help! - 22/06/09 03:17 PM
If the desired menuname ("menu location") is static, for example "in status and channel", use:
Code:
menu status,channel {
  My menu
  .nested menuitem1 : command
  .nested menuitem2 : command
}

If the place where the menu shall appear may change and you want to use a variable to define it, e.g. "%menu" with data "menubar,status":
Code:
menu * {
  $iif(($istok(%menu,$menu,44)),My menu)
  .nested menuitem1 : command
  .nested menuitem2 : command
}

If you don't want to nest any menuitems, put only the itemname in the $iff. Example:
Code:
menu status {
  $iif(($status == connected),disconnect now!) : .disconnect
}


Your initial $iif($gettok($findtok()) = x) was - well - bizarre!
Posted By: westor Re: $menu - help! - 22/06/09 10:55 PM
Thanks , i wanted the second method, i didn't know very well the $iif identifier, now i am trying to learn more about it!
© mIRC Discussion Forums