Communication Menu – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (changed wiki tags for submenu)
m (Fix page)
Line 1: Line 1:
[[Category:Arma 3: Editing|Communication Menu]]
[[File:A3_commMenu.jpg|thumb|Communication menu and icons]]
[[File:A3_commMenu.jpg|thumb|Communication menu and icons]]
Communication menu is a commanding menu where support or mission requests are placed.
Communication menu is a commanding menu where support or mission requests are placed.
Line 8: Line 6:
* Press '''8-1''' (Reply - Communication)
* Press '''8-1''' (Reply - Communication)


Available items are announced upon adding by a [[Notification]] and remain visualized as icons next to the commanding menu.
Available items are announced upon adding by a [[Arma 3 Notification|notification]] and remain visualized as icons next to the commanding menu.
 


== Configuration ==
== Configuration ==
=== Config ===
=== Config ===
Communication menu items can be defined in config - global [[Config.cpp]], campaign [[Description.ext]] or mission Description.ext (searched in this order, the latter has the highest priority).
 
Communication menu items can be defined in config - global [[Config.cpp]], [[Campaign Description.ext]] or mission [[Description.ext]] (searched in this order, the latter has the highest priority).


[[File:CommunicationMenuIconsA3Beta.jpg|thumb|Preview and path for icons]]
[[File:CommunicationMenuIconsA3Beta.jpg|thumb|Preview and path for icons]]
<syntaxhighlight lang="cpp">class CfgCommunicationMenu
{
class myArtillery
{
text = "Artillery Strike"; // Text displayed in the menu and in a notification
submenu = ""; // Submenu opened upon activation (expression is ignored when submenu is not empty.)
expression = "player setVariable ['BIS_SUPP_request', ['Artillery', _pos]];"; // Code executed upon activation
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa"; // Icon displayed permanently next to the command menu
cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; // Custom cursor displayed when the item is selected
enable = "1"; // Simple expression condition for enabling the item
removeAfterExpressionCall = 1; // 1 to remove the item after calling
};
};</syntaxhighlight>


  class CfgCommunicationMenu
Available default icons:
  {
  "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''artillery_ca'''.paa"
    class myArtillery
  "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''attack_ca'''.paa"
    {
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''call_ca'''.paa"
        text = "Artillery Strike"; {{codecomment|// Text displayed in the menu and in a notification}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''cas_ca'''.paa"
        submenu = ""; {{codecomment|// Submenu opened upon activation (expression is ignored when submenu is not empty.)}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''casheli_ca'''.paa"
        expression = "player setVariable ['BIS_SUPP_request', ['Artillery', _pos]];"; {{codecomment|// Code executed upon activation}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''defend_ca'''.paa"
        icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa"; {{codecomment|// Icon displayed permanently next to the command menu}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''instructor_ca'''.paa"
        cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; {{codecomment|// Custom cursor displayed when the item is selected}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''mortar_ca'''.paa"
        enable = "1"; {{codecomment|// Simple expression condition for enabling the item}}
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''supplydrop_ca'''.paa"
        removeAfterExpressionCall = 1; {{codecomment|// 1 to remove the item after calling}}
  "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\'''transport_ca'''.paa"
    };
  };


You can also preview pre-defined items using the config viewer.
You can also preview pre-defined items using the [[BIS_fnc_configViewer|Splendid™ Config Viewer]].


=== Adding ===
=== Adding ===
Use following functions to add the item in your mission or system:
Use following functions to add the item in your mission or system:
*[[BIS_fnc_addCommMenuItem]]
* [[BIS_fnc_addCommMenuItem]]
*[[BIS_fnc_removeCommMenuItem]]
* [[BIS_fnc_removeCommMenuItem]]


Number of slots is limited to 10, no pagination is implemented. Larger number is an edge case, no mission should need as many supports.
Number of slots is limited to 10, no pagination is implemented. Larger number is an edge case, no mission should need as many supports.


=== Expression Arguments ===
=== Expression Arguments ===
Following arguments are passed into the expression field:
Following arguments are passed into the expression field:
  [caller,pos,target,is3D,ID]
  [caller, pos, target, is3D, id]
*'''caller''': [[Object]] - unit which called the item, usually [[player]]
* '''caller''': [[Object]] - unit which called the item, usually [[player]]
*'''pos''': [[Array]] in format [[Position]] - cursor position
* '''pos''': [[Array]] in format [[Position]] - cursor position
*'''target''': [[Object]] - cursor target
* '''target''': [[Object]] - cursor target
*'''is3D''': [[Boolean]] - [[true]] when in 3D scene, [[false]] when in map
* '''is3D''': [[Boolean]] - [[true]] when in 3D scene, [[false]] when in map
*'''ID''': [[String]] - item ID as returned by BIS_fnc_addCommMenuItem function
* '''id''': [[String]] - item ID as returned by [[BIS_fnc_addCommMenuItem]] function


=== Submenu ===
=== Submenu ===
submenu = "#USER:MENU_COMMS_1"; {{codecomment|// 'MENU_COMMS_1' is just a global variable, can name it anything}}
 
<code>[[showCommandingMenu]] '#USER:MENU_COMMS_1';  {{codecomment|// if you wanted to show your custom menu on a keydown event or something}}</code>
submenu = "#USER:MENU_COMMS_1"; {{codecomment|// 'MENU_COMMS_1' is just a global variable, can name it anything}}
 
[[showCommandingMenu]] '#USER:MENU_COMMS_1';  {{codecomment|// if you wanted to show your custom menu on a keydown event or something}}




<code>
<code>MENU_COMMS_1 =
MENU_COMMS_1 =
[
[
{{codecomment|// First array: "User menu" This will be displayed under the menu, bool value: has Input Focus or not.}}
{{codecomment|// First array: "User menu" This will be displayed under the menu, bool value: has Input Focus or not.}}
{{codecomment|// Note that as to version Arma2 1.05, if the bool value set to false, Custom Icons will not be displayed.}}
{{codecomment|// Note that as of version {{arma3}} 1.05, if the bool value is set to false, Custom Icons will not be displayed.}}
["MenuName",false],
["MenuName", [[false]]],
{{codecomment|// Syntax and semantics for following array elements:}}
{{codecomment|// Syntax and semantics for following array elements:
{{codecomment|// ["Title_in_menu", [assigned_key], "Submenu_name", CMD, <nowiki>[[</nowiki>"expression",script-string]], "isVisible", "isActive" <, optional icon path> ]}}
// ["Title_in_menu", [assigned_key], "Submenu_name", CMD, <nowiki>[[</nowiki>"expression",script-string]], "isVisible", "isActive" (, optional icon path)]
{{codecomment|// Title_in_menu: string that will be displayed for the player}}
// Title_in_menu: string that will be displayed for the player
{{codecomment|// Assigned_key: 0 - no key, 1 - escape key, 2 - key-1, 3 - key-2, ... , 10 - key-9, 11 - key-0, 12 and up... the whole keyboard}}
// Assigned_key: 0 - no key, 1 - escape key, 2 - key-1, 3 - key-2, ... , 10 - key-9, 11 - key-0, 12 and up... the whole keyboard
{{codecomment|// Submenu_name: User menu name string (eg "#USER:MY_SUBMENU_NAME" ), "" for script to execute.}}
// Submenu_name: User menu name string (eg "#USER:MY_SUBMENU_NAME" ), "" for script to execute.
{{codecomment|// CMD: (for main menu:) CMD_SEPARATOR -1; CMD_NOTHING -2; CMD_HIDE_MENU -3; CMD_BACK -4; (for custom menu:) CMD_EXECUTE -5}}
// CMD: (for main menu:) CMD_SEPARATOR -1; CMD_NOTHING -2; CMD_HIDE_MENU -3; CMD_BACK -4; (for custom menu:) CMD_EXECUTE -5
{{codecomment|// script-string: command to be executed on activation.  (_target<nowiki>=</nowiki>CursorTarget,_pos<nowiki>=</nowiki>CursorPos) }}
// script-string: command to be executed on activation.  (_target<nowiki>=</nowiki>CursorTarget,_pos<nowiki>=</nowiki>CursorPos)
{{codecomment|// isVisible - Boolean 1 or 0 for yes or no, - or optional argument string, eg: "CursorOnGround"}}
// isVisible - Boolean 1 or 0 for yes or no, - or optional argument string, eg: "CursorOnGround"
{{codecomment|// isActive - Boolean 1 or 0 for yes or no - if item is not active, it appears gray.}}
// isActive - Boolean 1 or 0 for yes or no - if item is not active, it appears gray.
{{codecomment|// optional icon path: The path to the texture of the cursor, that should be used on this menuitem.}}
// optional icon path: The path to the texture of the cursor, that should be used on this menuitem.}}
["Teleport", [2], "", -5, <nowiki>[[</nowiki>"expression", "Player SetPos _pos;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
["Teleport", [2], "", -5, <nowiki>[[</nowiki>"expression", "[[player]] [[setPos]] _pos;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
["Kill Target", [3], "", -5, <nowiki>[[</nowiki>"expression", "_target SetDamage 1;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
["Kill Target", [3], "", -5, <nowiki>[[</nowiki>"expression", "_target [[setDamage]] 1;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
["Disabled", [4], "", -5, <nowiki>[[</nowiki>"expression", ""]], "1", "0"],
["Disabled", [4], "", -5, <nowiki>[[</nowiki>"expression", ""]], "1", "0"],
["Submenu", [5], "#USER:MENU_COMMS_2", -5, <nowiki>[</nowiki>], "1", "1"]
["Submenu", [5], "#USER:MENU_COMMS_2", -5, <nowiki>[</nowiki>], "1", "1"]
];
];<br>
 
MENU_COMMS_2 =
MENU_COMMS_2 =
[
[
["Submenu",false],
["Submenu", [[false]]],
["Option 1", [2], "", -5, <nowiki>[[</nowiki>"expression", "Hint 'Option 1';"]], "1", "1"],
["Option 1", [2], "", -5, <nowiki>[[</nowiki>"expression", "[[hint]] 'Option 1';"]], "1", "1"],
["Option 2", [3], "", -5, <nowiki>[[</nowiki>"expression", "Hint 'Option 2';"]], "1", "1"],
["Option 2", [3], "", -5, <nowiki>[[</nowiki>"expression", "[[hint]] 'Option 2';"]], "1", "1"],
["Option 3", [4], "", -5, <nowiki>[[</nowiki>"expression", "Hint 'Option 3';"]], "1", "1"]
["Option 3", [4], "", -5, <nowiki>[[</nowiki>"expression", "[[hint]] 'Option 3';"]], "1", "1"]
];
];
</code>
</code>
[[Category:Arma 3: Editing|Communication Menu]]

Revision as of 20:51, 8 August 2019

Communication menu and icons

Communication menu is a commanding menu where support or mission requests are placed.

The player can access it using following means:

  • Open the quick command menu ('~' by default) and select "Communication" item
  • Press 8-1 (Reply - Communication)

Available items are announced upon adding by a notification and remain visualized as icons next to the commanding menu.


Configuration

Config

Communication menu items can be defined in config - global Config.cpp, Campaign Description.ext or mission Description.ext (searched in this order, the latter has the highest priority).

Preview and path for icons
class CfgCommunicationMenu
{
	class myArtillery
	{
		text = "Artillery Strike";		// Text displayed in the menu and in a notification
		submenu = "";					// Submenu opened upon activation (expression is ignored when submenu is not empty.)
		expression = "player setVariable ['BIS_SUPP_request', ['Artillery', _pos]];";	// Code executed upon activation
		icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa";				// Icon displayed permanently next to the command menu
		cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa";				// Custom cursor displayed when the item is selected
		enable = "1";					// Simple expression condition for enabling the item
		removeAfterExpressionCall = 1;	// 1 to remove the item after calling
	};
};

Available default icons:

"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\attack_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\casheli_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\defend_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\instructor_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\mortar_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa"
"\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa"

You can also preview pre-defined items using the Splendid™ Config Viewer.

Adding

Use following functions to add the item in your mission or system:

Number of slots is limited to 10, no pagination is implemented. Larger number is an edge case, no mission should need as many supports.

Expression Arguments

Following arguments are passed into the expression field:

[caller, pos, target, is3D, id]

Submenu

submenu = "#USER:MENU_COMMS_1"; // 'MENU_COMMS_1' is just a global variable, can name it anything
showCommandingMenu '#USER:MENU_COMMS_1';  // if you wanted to show your custom menu on a keydown event or something


MENU_COMMS_1 = [ // First array: "User menu" This will be displayed under the menu, bool value: has Input Focus or not. // Note that as of version Arma 3 1.05, if the bool value is set to false, Custom Icons will not be displayed. ["MenuName", false], // Syntax and semantics for following array elements: // ["Title_in_menu", [assigned_key], "Submenu_name", CMD, [["expression",script-string]], "isVisible", "isActive" (, optional icon path)] // Title_in_menu: string that will be displayed for the player // Assigned_key: 0 - no key, 1 - escape key, 2 - key-1, 3 - key-2, ... , 10 - key-9, 11 - key-0, 12 and up... the whole keyboard // Submenu_name: User menu name string (eg "#USER:MY_SUBMENU_NAME" ), "" for script to execute. // CMD: (for main menu:) CMD_SEPARATOR -1; CMD_NOTHING -2; CMD_HIDE_MENU -3; CMD_BACK -4; (for custom menu:) CMD_EXECUTE -5 // script-string: command to be executed on activation. (_target=CursorTarget,_pos=CursorPos) // isVisible - Boolean 1 or 0 for yes or no, - or optional argument string, eg: "CursorOnGround" // isActive - Boolean 1 or 0 for yes or no - if item is not active, it appears gray. // optional icon path: The path to the texture of the cursor, that should be used on this menuitem. ["Teleport", [2], "", -5, [["expression", "player setPos _pos;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"], ["Kill Target", [3], "", -5, [["expression", "_target setDamage 1;"]], "1", "1", "\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"], ["Disabled", [4], "", -5, [["expression", ""]], "1", "0"], ["Submenu", [5], "#USER:MENU_COMMS_2", -5, [], "1", "1"] ];
MENU_COMMS_2 = [ ["Submenu", false], ["Option 1", [2], "", -5, [["expression", "hint 'Option 1';"]], "1", "1"], ["Option 2", [3], "", -5, [["expression", "hint 'Option 2';"]], "1", "1"], ["Option 3", [4], "", -5, [["expression", "hint 'Option 3';"]], "1", "1"] ];