mIRC Home    About    Download    Register    News    Help

Print Thread
#213242 22/06/09 02:00 PM
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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
  }
}

Last edited by westor; 22/06/09 02:01 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #213245 22/06/09 02:34 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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.

Last edited by Horstl; 22/06/09 02:41 PM.
westor #213246 22/06/09 02:37 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #213247 22/06/09 02:47 PM
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #213248 22/06/09 03:17 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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!

Horstl #213264 22/06/09 10:55 PM
Joined: Dec 2008
Posts: 1,515
westor Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Thanks , i wanted the second method, i didn't know very well the $iif identifier, now i am trying to learn more about it!

Last edited by westor; 22/06/09 10:57 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard