{"name":"onHCGroupSelectionChanged","operator":null,"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","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Defines an action performed when high command group selection has been changed.\n\nCommand receives 2 variables:\n- _group: Group - last selected/deselected group\n- _isSelected: Boolean - new selection state of the specific group\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","since":null,"effect":null,"exec":null,"params":[{"name":"code","type":"String or Code","optional":false,"default":null,"description":null,"types":["String","Code"],"since":null,"text":"code: String or Code"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"code","types":["String","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};"]},{"text":"```sqf\nonHCGroupSelectionChanged \"player globalChat 'HC group selection has been changed.';\";\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 {};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["High Command","hcAllGroups","hcGroupParams","hcLeader","hcRemoveAllGroups","hcRemoveGroup","hcSelected","hcSelectGroup","hcSetGroup","hcShowBar","hcShownBar","onCommandModeChanged"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Event Handlers","Command Group: High Command","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}