Popups
mIRC allows you to create custom popup menus for the status window, query/chat windows, channel windows, the channel nickname listbox, and main menubar. To create these you must know how to use Basic IRC commands, how to create Aliases, and how to use Identifiers and Variables.
If you click the right mouse-button in a window, the popup menu for that window will appear and you can select menu-items which you have defined to perform certain tasks, such as opping a user or joining a channel.
Examples Popup menu definitions use the format:
<menuitem>:<commands>
Get Help:/join #irchelp
The words before the ":" colon are the name of the menuitem. The words after the ":" colon are the commands that are to be performed. In this case, the menuitem you would see is "Get Help". The command that would be performed if you select this menuitem would be "/join #irchelp", as if you had typed it.
The format of the commands follows precisely the same as those in normal aliases. See the Aliases section to learn about aliases.
To create a Submenu, use a "." full stop.
Join a Channel .Get IRC help!:/join #irchelp .Visit the folks at #friendly:/join #friendly .Who shall we join?:/join $?
In this case, the name of the submenu is "Join a Channel". All the commands following it beginning with a "." are part of this submenu.
To create menus within a submenu, you just add more full stops:
Channels .Help ..irchelp:/join #irchelp ..mIRC:/join #mirc ..newbies:/join #newbies .Other Channels ..Visit #friendly:/join #friendly ..Wibble Wobble:/join #wibble .Join?:/join #$$?="Enter a channel name:"
To separate menuitems, you can use a single "-" dash on a line by itself.
whois ?:/whois $? - Misc .Edit Temp:/run notepad.exe temp.txt .say?: /say $? .action?:/me $? Names .#irchelp: /names #irchelp .#friendly: /names #friendly .names ?:/names $? - channel list:/list - Join a Channel .Get IRC help!:/join #irchelp .Visit the folks at #friendly:/join #friendly .Who shall we join?:/join $?
To use the popup menu for a channel nickname listbox, you need to select a nickname before the menu will pop up. Here is a simple nickname listbox popup menu:
Who Is?:/whois $1 - Modes .Op:/mode # +o $1 .Deop:/mode # -o $1 .Kick, Ban:/kick # $1 | /ban $1 - DCC Send:/dcc send $1 DCC Chat:/dcc chat $1 - Slap!:/me slaps $1 around a bit with a large trout Query:/query $1 Hey you! hello? are you there...?
If you want to create a popup menu item which performs several commands, you can use the { } brackets. See the Aliases section for more information on how to use these.
Cookie { if ($1 == $me) echo I give myself a cookie! else echo I give $1 a cookie! }
The above menitem can be used in the channel nicknames listbox. The $1 refers to the nickname of the user you have selected in the listbox. In this case, it checks to see if I have selected my own nickname, and if so displays the first message, otherwise it displays the second message.
The popup menus for the Query/Chat and the MenuBar work the same way as the channel listbox popup menu.
Identifiers and Variables Variables or identifiers that are a part of a the title of a menu definition are evaluated each time the popup appears. This allows you to create popup menus that vary in appearance. If an entire menu item evaluates to $null, it is not displayed.
Remote Scripts You can place menu definitions in your remote scripts by using the menu prefix.
menu status { Server .Links:/links .Lusers:/lusers .Motd:/motd .Time:/time }
This definition would add a submenu to your status window popup menu.
You can also specify channel, query, nicklist, and menubar as the menu name, and this will add menuitems to your current popup menus for each of these windows.
menu nicklist { Slap .Haddock:/me prods $1 with a haddock }
This definition would add a submenu to your channel nickname listbox popup menu.
You can also specify popup menus for custom windows by specifying the custom window name.
menu @test { dclick:/echo double-click! }
The dclick item allows you to specify a command that will be performed when you double-click in a custom window listbox. You can also refer to $1 which holds the line number of the line that was double-clicked.
You can also specify multiple window names for a menu, eg.:
menu @dogs,@cats,@goats { dclick: /echo double-click in $active close: window -c $active }
You can use the $menu, $menutype, and $menucontext identifiers to refer to the menu that is about to pop up or that is associated with the script being performed. This allows you to modify the form of the popup based on whether it is a query, channel, etc. popup menu:
menu query,nicklist { $iif($menu == nicklist,Op):/mode # +o $$1 }
You can place a check mark or create a disabled menu item by using the $style(N) identifier, where N = 1 for checked, N = 2 for disabled, and N = 3 for both. The $style(N) identifier must be the first word in the menu definition.
menu status { $iif($server == $null,$style(2)) Server Info .Motd:/motd .Time:/time }
The above definition creates a submenu in your status window popup which is only enabled when you are connected to an IRC server.
This identifier allows you to dynamically create a list of menu items, and can only be called from a popup menu definition.
It calls $id($1), where $id() is the name of your identifer, and where $1 = 1, and increases by 1 with each call, adding whatever is returned by $id() to the popup menu.
The value that $id() returns must be a one line definition format for a popup menu.
The iteration ends when $id() returns no value.
menu status { Animal .$submenu($animal($1)) }
alias animal { if ($1 == begin) return - if ($1 == 1) return Cow:echo Cow if ($1 == 2) return Llama:echo Llama if ($1 == 3) return Emu:echo Emu if ($1 == end) return - }
The begin and end values are sent to check if the item should be enclosed in separators.
Note: You cannot use this to create nested submenus, it will only build one single submenu. |