BIS fnc holdActionAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Fix description and tabs)
Line 2: Line 2:
____________________________________________________________________________________________
____________________________________________________________________________________________


| arma3 |= Game name
| arma3 |Game name=


|1.62|= Game version
|1.62|Game version=


|arg= global |= Arguments in MP
|arg= global |Arguments in MP=


|eff= local |= Effects in MP
|eff= local |Effects in MP=
____________________________________________________________________________________________
____________________________________________________________________________________________


| Adds an action to an object which requires the user to hold a key to perform the action.|= Description
| Adds an action to an object which requires the user to hold a key to perform the action. |Description=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [target, title, idleIcon, progressIcon, conditionShow, conditionProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority(, removeCompleted, showUnconscious)] call [[BIS_fnc_holdActionAdd]] |= Syntax
| [target, title, idleIcon, progressIcon, conditionShow, conditionProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority, ''removeCompleted, showUnconscious''] call [[BIS_fnc_holdActionAdd]] |Syntax=


|p1= target: [[Object]] - Object the action is attached to |= Parameter 1
|p1= target: [[Object]] - Object the action is attached to |Parameter 1=


|p2= title: [[String]] - Title of the action shown in the action menu |= Parameter 2
|p2= title: [[String]] - Title of the action shown in the action menu |Parameter 2=


|p3= idleIcon: [[String]] - Path of the idle icon shown on screen. See [[#Notes|notes]] for a full list of vanilla icons. |= Parameter 3
|p3= idleIcon: [[String]] - Path of the idle icon shown on screen. See [[#Notes|notes]] for a full list of vanilla icons. |Parameter 3=


|p4= progressIcon: [[String]] - Path of the progress icon shown on screen |= Parameter 4
|p4= progressIcon: [[String]] - Path of the progress icon shown on screen |Parameter 4=


|p5= conditionShow: [[String]] - Condition for the action to be shown.<br />
|p5= conditionShow: [[String]] - Condition for the action to be shown.<br />
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit) |= Parameter 5
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit) |Parameter 5=


|p6= conditionProgress: [[String]] - Condition for the action to progress; if false is returned action progress is paused.<br />
|p6= conditionProgress: [[String]] - Condition for the action to progress; if false is returned action progress is paused.<br />
Special arguments passed to the code: _target, _caller, _id, _arguments |= Parameter 6
Special arguments passed to the code: _target, _caller, _id, _arguments |Parameter 6=


|p7= codeStart: [[Code]] - Code executed when action starts. Special arguments:
|p7= codeStart: [[Code]] - Code executed when action starts. Passed arguments are:
<syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments"];</syntaxhighlight>
* _this select 0: [[Object]] - the object which the action is assigned to
* _this select 0: [[Object]] - the object which the action is assigned to
* _this select 1: [[Object]] - the unit that activated the action
* _this select 1: [[Object]] - the unit that activated the action
* _this select 2: [[Number]] - ID of the activated action (same as ID returned by addAction)
* _this select 2: [[Number]] - ID of the activated action (same as ID returned by addAction)
* _this select 3: [[Array]] - arguments given to the function |= Parameter 7
* _this select 3: [[Array]] - arguments given to the function |Parameter 7=


|p8= codeProgress: [[Code]] - Code executed on every progress tick. Special arguments:
|p8= codeProgress: [[Code]] - Code executed on every progress tick. Passed arguments are:
<syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];</syntaxhighlight>
* _this select 0: [[Object]] - the object which the action is assigned to
* _this select 0: [[Object]] - the object which the action is assigned to
* _this select 1: [[Object]] - the unit that activated the action
* _this select 1: [[Object]] - the unit that activated the action
Line 42: Line 44:
* _this select 3: [[Array]] - arguments given to the function
* _this select 3: [[Array]] - arguments given to the function
* _this select 4: [[Number]] - currentProgress; progress goes from 1 to 24
* _this select 4: [[Number]] - currentProgress; progress goes from 1 to 24
* _this select 5: [[Number]] - max progress (24) |= Parameter 8
* _this select 5: [[Number]] - max progress (24) |Parameter 8=


|p9= codeCompleted: [[Code]] - Code executed on completion; arguments [target, caller, ID, arguments] |= Parameter 9
|p9= codeCompleted: [[Code]] - code executed on completion; arguments. Passed arguments are:
<syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments"]; // same as codeStart</syntaxhighlight> |Parameter 9=


|p10= codeInterrupted: [[Code]] - Code executed on interrupted; arguments [target, caller, ID, arguments] |= Parameter 10
|p10= codeInterrupted: [[Code]] - code executed on interrupted; arguments [target, caller, ID, arguments] |Parameter 10=


|p11= arguments: [[Array]] - Arguments passed to the scripts |= Parameter 11
|p11= arguments: [[Array]] - arguments passed to the scripts |Parameter 11=


|p12= duration: [[Number]] - Action duration; how much time it takes to complete the action |= Parameter 12
|p12= duration: [[Number]] - action duration, a.k.a how much time it takes to complete the action |Parameter 12=


|p13= priority: [[Number]] - Priority; actions are arranged in descending order according to this value |= Parameter 13
|p13= priority: [[Number]] - priority value; actions are arranged in descending order according to this value |Parameter 13=


|p14= removeCompleted (Optional, default: true): [[Boolean]] - Remove on completion |= Parameter 14
|p14= removeCompleted: [[Boolean]] - (Optional, default [[true]]) remove on completion |Parameter 14=


|p15= showUnconscious (Optional, default: false): [[Boolean]] - Show in unconscious state |= Parameter 15
|p15= showUnconscious: [[Boolean]] - (Optional, default [[false]]) show in unconscious state |Parameter 15=


|x1= <code><nowiki>[</nowiki>[[player]], "Kill", "", "", "[[true]]", "[[true]]", { [[hint]] "Started!" }, { [[systemChat]] [[str]] (_this select 3) }, { [[player]] [[setDamage]] 1 }, { [[hint]] "Afraid of death?" }, [], 10, [[nil]], [[true]], [[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code>
|x1= <code><nowiki>[</nowiki>[[player]], "Kill", "", "", "[[true]]", "[[true]]", { [[hint]] "Started!" }, { [[systemChat]] [[str]] (_this select 3) }, { [[player]] [[setDamage]] 1 }, { [[hint]] "Afraid of death?" }, [], 10, [[nil]], [[true]], [[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code> |Example 1=
|= Example 1
|x2= <code>[
|x2= <code>[
_myLaptop, {{codecomment|// Object the action is attached to}}
_myLaptop, {{codecomment|// Object the action is attached to}}
"Hack Laptop", {{codecomment|// Title of the action}}
"Hack Laptop", {{codecomment|// Title of the action}}
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{codecomment|// Idle icon shown on screen}}
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{codecomment|// Idle icon shown on screen}}
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{codecomment|// Progress icon shown on screen}}
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{codecomment|// Progress icon shown on screen}}
"_this [[distance]] _target < 3", {{codecomment|// Condition for the action to be shown}}
"_this [[distance]] _target < 3", {{codecomment|// Condition for the action to be shown}}
"_caller [[distance]] _target < 3", {{codecomment|// Condition for the action to progress}}
"_caller [[distance]] _target < 3", {{codecomment|// Condition for the action to progress}}
{}, {{codecomment|// Code executed when action starts}}
{}, {{codecomment|// Code executed when action starts}}
{}, {{codecomment|// Code executed on every progress tick}}
{}, {{codecomment|// Code executed on every progress tick}}
{ _this [[call]] MY_fnc_hackingCompleted }, {{codecomment|// Code executed on completion}}
{ _this [[call]] MY_fnc_hackingCompleted }, {{codecomment|// Code executed on completion}}
{}, {{codecomment|// Code executed on interrupted}}
{}, {{codecomment|// Code executed on interrupted}}
[], {{codecomment|// Arguments passed to the scripts as _this select 3}}
[], {{codecomment|// Arguments passed to the scripts as _this select 3}}
12, {{codecomment|// Action duration [s]}}
12, {{codecomment|// Action duration [s]}}
0, {{codecomment|// Priority}}
0, {{codecomment|// Priority}}
[[true]], {{codecomment|// Remove on completion}}
[[true]], {{codecomment|// Remove on completion}}
[[false]] {{codecomment|// Show in unconscious state }}
[[false]] {{codecomment|// Show in unconscious state }}
] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]", [0,2] select [[isDedicated]], _myLaptop]; {{codecomment|// MP compatible implementation}}</code>
] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]", 0, _myLaptop]; {{codecomment|// MP compatible implementation}}</code> |Example 2=
|= Example 2


| [[Number]] - Action ID |= Return value
| [[Number]] - Action ID |Return value=
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
| [[BIS_fnc_holdActionRemove]], [[BIS_fnc_holdKey]] |= See also


| [[BIS_fnc_holdActionRemove]], [[BIS_fnc_holdKey]] |See also=
}}
}}


Line 90: Line 89:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Debug|{{uc:param}}]]
[[Category:Functions|{{uc:holdActionAdd}}]]
[[Category:Functions|{{uc:param}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:holdActionAdd}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:param}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:param}}]]


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
Line 114: Line 112:
* "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''takeOff2'''_ca.paa"
* "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''takeOff2'''_ca.paa"
* "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''unbind'''_ca.paa"
* "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''unbind'''_ca.paa"
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on May 27, 2018 - 18:02 (UTC)</dd>
<dt class="note">[[User:SuicideKing|SuicideKing]]</dt>
<dd class="note">
Example 2 above should use [0,-2] with the select command in the remote exec arguments.
<br>
<code>remoteExec ["BIS_fnc_holdActionAdd", [0,-2] select isDedicated, _myLaptop]; // MP compatible implementation</code>
<br>
Using -2 ensures that the code is run for clients only (and not the server) if it's run on a dedicated server. Currently it runs it on the server only in such a case.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 21:33, 27 May 2018

Hover & click on the images for description

Description

Description:
Adds an action to an object which requires the user to hold a key to perform the action.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[target, title, idleIcon, progressIcon, conditionShow, conditionProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority, removeCompleted, showUnconscious] call BIS_fnc_holdActionAdd
Parameters:
target: Object - Object the action is attached to
title: String - Title of the action shown in the action menu
idleIcon: String - Path of the idle icon shown on screen. See notes for a full list of vanilla icons.
progressIcon: String - Path of the progress icon shown on screen
conditionShow: String - Condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit)
conditionProgress: String - Condition for the action to progress; if false is returned action progress is paused.
Special arguments passed to the code: _target, _caller, _id, _arguments
codeStart: Code - Code executed when action starts. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"];
  • _this select 0: Object - the object which the action is assigned to
  • _this select 1: Object - the unit that activated the action
  • _this select 2: Number - ID of the activated action (same as ID returned by addAction)
  • _this select 3: Array - arguments given to the function
codeProgress: Code - Code executed on every progress tick. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];
  • _this select 0: Object - the object which the action is assigned to
  • _this select 1: Object - the unit that activated the action
  • _this select 2: Number - ID of the activated action (same as ID returned by addAction)
  • _this select 3: Array - arguments given to the function
  • _this select 4: Number - currentProgress; progress goes from 1 to 24
  • _this select 5: Number - max progress (24)
codeCompleted: Code - code executed on completion; arguments. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"]; // same as codeStart
codeInterrupted: Code - code executed on interrupted; arguments [target, caller, ID, arguments]
arguments: Array - arguments passed to the scripts
duration: Number - action duration, a.k.a how much time it takes to complete the action
priority: Number - priority value; actions are arranged in descending order according to this value
removeCompleted: Boolean - (Optional, default true) remove on completion
showUnconscious: Boolean - (Optional, default false) show in unconscious state
Return Value:
Number - Action ID

Examples

Example 1:
[player, "Kill", "", "", "true", "true", { hint "Started!" }, { systemChat str (_this select 3) }, { player setDamage 1 }, { hint "Afraid of death?" }, [], 10, nil, true, false] call BIS_fnc_holdActionAdd;
Example 2:
[ _myLaptop, // Object the action is attached to "Hack Laptop", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick { _this call MY_fnc_hackingCompleted }, // Code executed on completion {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 12, // Action duration [s] 0, // Priority true, // Remove on completion false // Show in unconscious state ] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop]; // MP compatible implementation

Additional Information

See also:
BIS_fnc_holdActionRemoveBIS_fnc_holdKey

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section

Posted on November 4, 2017 - 13:40 (UTC)
Lou Montana
A list of all official icons so far (v1.76):
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_forceRespawn_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_revive_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa"