UserActions: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " (={2,})([^ = ])(.*)([^ = ])(={2,}) * " to " $1 $2$3$4 $5 ")
(updated example, added category)
Line 1: Line 1:
==Description==
Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles.
Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles.


== Class Properties ==
== Class Properties ==
* '''displayName''': string - This is the name displayed in the action menu. It supports [[Structured_Text|structured text]] syntax, for including icons or changing the text appearance.
* '''displayName''': [[String]] - This is the name displayed in the action menu. It supports [[Structured_Text|structured text]] syntax, for including icons or changing the text appearance.
* '''displayNameDefault''': string - This is the name displayed near mid screen. It supports [[Structured_Text|structured text]] syntax, for including icons or changing the text appearance. Often, only an icon is used in this case.
* '''displayNameDefault''': [[String]] - This is the name displayed near mid screen. It supports [[Structured_Text|structured text]] syntax, for including icons or changing the text appearance. Often, only an icon is used in this case.
* '''priority''': integer - Priority value of the action. Actions will be arranged descending according to this. Value can be negative or decimal. Actions with same values will be arranged in order which they were made, newest at the bottom. Typical range is 0 (low priority) to 6 (high priority).  
* '''priority''': [[Number]] - Priority value of the action. Actions will be arranged descending according to this. Value can be negative or decimal. Actions with same values will be arranged in order which they were made, newest at the bottom. Typical range is 0 (low priority) to 6 (high priority).  
* '''radius''': number - Defines the range to the object at which the action will become available. Value is in metres.
* '''radius''': [[Number]] - Defines the range to the object at which the action will become available. Value is in metres.
* '''position''': string - Memory point which acts as the centre for the radius check. [https://feedback.bistudio.com/T126930#1649747 May be replaced with named selections (actionNamedSel) in Tac-Ops DLC]
* '''position''': [[String]] - Memory point which acts as the centre for the radius check. [https://feedback.bistudio.com/T126930#1649747 May be replaced with named selections (actionNamedSel) in Tac-Ops DLC]
* '''showWindow''': number/(boolean) - If set to 1 or "true", players see the 'displayNameDefault' name appear near mid screen as they approach the object if the priority is higher than other available actions. Set to 0 or "false" to turn it off.
* '''showWindow''': [[Number]] or [[Boolean]] - If set to 1 or [[true]], players see the 'displayNameDefault' name appear near mid screen as they approach the object if the priority is higher than other available actions. Set to 0 or [[false]] to turn it off.
* '''hideOnUse''': number/(boolean) - If set to 1 or "true", it will hide the action menu after selecting that action. If set to 0 or "false", it will leave the action menu open and visible after selecting that action, leaving the same action highlighted, for the purpose of allowing you to reselect that same action quickly, or to select another action.
* '''hideOnUse''': [[Number]] or [[Boolean]] - If set to 1 or [[true]], it will hide the action menu after selecting that action. If set to 0 or "false", it will leave the action menu open and visible after selecting that action, leaving the same action highlighted, for the purpose of allowing you to reselect that same action quickly, or to select another action.
* '''onlyForPlayer''': number/(boolean) - (Needs clarification.) Probably disables the action appearing in the Action list (option 6) on the main menu for AI.
* '''onlyForPlayer''': [[Number]] or [[Boolean]] - Probably disables the action appearing in the Action list (option 6) on the main menu for AI. {{Clarify}}
* '''shortcut''': string - One of the [[:Category:Key Actions|key mapping names]] defined in class 'CfgDefaultKeysMapping' in bin.pbo (e.g. "moveForward").
* '''shortcut''': [[String]] - One of the [[:Category:Key Actions|key mapping names]] defined in class 'CfgDefaultKeysMapping' in bin.pbo (e.g. "moveForward").
* '''condition''': string - Code that must return true for the action to be available. Some standard variables can be used in the evaluation. Variable [[this]] references the object to which action is attached to. (Needs confirmation: there must be a caller variable too (_this?).)
* '''condition''': [[String]] - Code that must return true for the action to be available. Some standard variables can be used in the evaluation. Variable [[this]] references the object to which action is attached to. (Needs confirmation: there must be a caller variable too (_this?). {{Clarify}})
* '''statement''': string - Code that is executed when the action is activated. Some standard variables can be used in the evaluation. Variable [[this]] references object to which action is attached to.
* '''statement''': [[String]] - Code that is executed when the action is activated. Some standard variables can be used in the evaluation. Variable [[this]] references object to which action is attached to.
* '''aiMaxRange''': number
* '''aiMaxRange''': [[Number]] {{Clarify}}


== Examples ==
== Examples ==
Example 1:
<syntaxhighlight lang="cpp">class CfgVehicles
<code><nowiki>class UserActions
{
{
   class viewHUD
   class CaManbase
   {
   {
     displayName = "<img image='\someAddon\images\icon1.paa' size='1' shadow='false' /> Show HUD";
     class UserActions
    displayNameDefault = "<img image='\someAddon\images\icon1.paa' size='3' shadow='false' />";
    {
    priority = 3;
      class testAction
    radius = 20;
      {
    position = "camera";
        displayName = "test";
    showWindow = 0;
        displayNameDefault = "test default";
    hideOnUse = 1;
        priority = 3;
    onlyForPlayer = 1;
        radius = 20;
    shortcut = "reloadMagazine";
        position = "camera";
    condition = "(player in [gunner this, driver this]) && (alive this)";
        showWindow = 0;
    statement = "[this, 10] execVM ""\someAddon\scripts\showHUD.sqf"";";
        hideOnUse = 1;
        onlyForPlayer = 0;
        shortcut = "";
        condition = "true";
        statement = "systemChat 'statement'";
      };
    };
   };
   };
};
};</syntaxhighlight>
</nowiki></code>


== Additional Information ==
== Additional Information ==
Line 42: Line 45:
__NOTOC__  
__NOTOC__  


{{GameCategory|arma1|Reference Lists}}
{{GameCategory|arma1|Editing}}
{{GameCategory|arma2|Editing}}
{{GameCategory|arma2oa|Editing}}
{{GameCategory|arma3|Editing}}

Revision as of 09:43, 14 February 2021

Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles.

Class Properties

  • displayName: String - This is the name displayed in the action menu. It supports structured text syntax, for including icons or changing the text appearance.
  • displayNameDefault: String - This is the name displayed near mid screen. It supports structured text syntax, for including icons or changing the text appearance. Often, only an icon is used in this case.
  • priority: Number - Priority value of the action. Actions will be arranged descending according to this. Value can be negative or decimal. Actions with same values will be arranged in order which they were made, newest at the bottom. Typical range is 0 (low priority) to 6 (high priority).
  • radius: Number - Defines the range to the object at which the action will become available. Value is in metres.
  • position: String - Memory point which acts as the centre for the radius check. May be replaced with named selections (actionNamedSel) in Tac-Ops DLC
  • showWindow: Number or Boolean - If set to 1 or true, players see the 'displayNameDefault' name appear near mid screen as they approach the object if the priority is higher than other available actions. Set to 0 or false to turn it off.
  • hideOnUse: Number or Boolean - If set to 1 or true, it will hide the action menu after selecting that action. If set to 0 or "false", it will leave the action menu open and visible after selecting that action, leaving the same action highlighted, for the purpose of allowing you to reselect that same action quickly, or to select another action.
  • onlyForPlayer: Number or Boolean - Probably disables the action appearing in the Action list (option 6) on the main menu for AI. Clarify
  • shortcut: String - One of the key mapping names defined in class 'CfgDefaultKeysMapping' in bin.pbo (e.g. "moveForward").
  • condition: String - Code that must return true for the action to be available. Some standard variables can be used in the evaluation. Variable this references the object to which action is attached to. (Needs confirmation: there must be a caller variable too (_this?). Clarify)
  • statement: String - Code that is executed when the action is activated. Some standard variables can be used in the evaluation. Variable this references object to which action is attached to.
  • aiMaxRange: Number Clarify

Examples

class CfgVehicles
{
  class CaManbase
  {
    class UserActions
    {
      class testAction
      {
        displayName = "test";
        displayNameDefault = "test default";
        priority = 3;
        radius = 20;
        position = "camera";
        showWindow = 0;
        hideOnUse = 1;
        onlyForPlayer = 0;
        shortcut = "";
        condition = "true";
        statement = "systemChat 'statement'";
      };
    };
  };
};

Additional Information

See also: addAction