{"name":"onHCGroupSelectionChanged","title":"onHCGroupSelectionChanged","type":"command","url":"https://community.bistudio.com/wiki/onHCGroupSelectionChanged","revid":369345,"updated":"2024-09-03T18:43:02Z","groups":["High Command","Event Handlers"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Defines an action performed when high command group selection has been changed.\nCommand receives 2 variables:\n\n- _group: Group - last selected/deselected group\n- _isSelected: Boolean - new selection state of the specific group\n\nThe code is executed on every hc group selection change until it is replaced or removed (see Example 3).\n\n> [!IMPORTANT]\n> Using the command again will **overwrite** the previously set code.\n\n> [!NOTE]\n> Since Arma 3 v1.58 a stackable version of this EH is available: HCGroupSelectionChanged","syntaxes":[{"syntax":"onHCGroupSelectionChanged code","params":[{"name":"code","type":"String or Code","type_expr":"String | Code"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"unary","right":{"text":"code"}}],"examples":[{"text":"```sqf\nonHCGroupSelectionChanged {\n    if (_isSelected) then\n    {\n        hint format [\"Group %1 has been selected.\", _group];\n    }\n    else\n    {\n        hint format [\"Group %1 has been deselected.\", _group];\n    };\n};\n```","code":["onHCGroupSelectionChanged {\n\tif (_isSelected) then\n\t{\n\t\thint format [\"Group %1 has been selected.\", _group];\n\t}\n\telse\n\t{\n\t\thint format [\"Group %1 has been deselected.\", _group];\n\t};\n};"]},{"code":["onHCGroupSelectionChanged \"player globalChat 'HC group selection has been changed.';\";"]},{"text":"Remove event handler:\n\n```sqf\nonHCGroupSelectionChanged \"\";\n// or\nonHCGroupSelectionChanged {};\n```","code":["onHCGroupSelectionChanged \"\";\n// or\nonHCGroupSelectionChanged {};"]}],"see_also":["High Command","hcAllGroups","hcGroupParams","hcLeader","hcRemoveAllGroups","hcRemoveGroup","hcSelected","hcSelectGroup","hcSetGroup","hcShowBar","hcShownBar","onCommandModeChanged"]}