Skip to content
PabstMirror edited this page Dec 31, 2014 · 37 revisions

Table Of Contents

Eventhandler:

Interaction Menu:

Misc:

Math:

Logistics:


AGM_Core_fnc_addActionEventHandler

Author: commy2

Description:

  • Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units.

Argument:

  • 0: Unit the action should be assigned to (Object)
  • 1: Name of the action, e.g. "DefaultAction" (String)
  • 2: Condition (Code or String)
  • 3: Code to execute (Code or String)

Return value:

  • ID of the action (used to remove it later).

Example:

  • tbd

AGM_Core_fnc_removeActionEventHandler

Author: commy2

Description:

  • Remove an addAction event from a unit.

Argument:

  • 0: Unit the action is assigned to (Object)
  • 1: Name of the action, e.g. "DefaultAction" (String)
  • 2: ID of the action (Number)

Return value:

  • None.

Example:

  • tbd

AGM_Core_fnc_addCameraEventHandler

Author: commy2

Description:

  • Add a camera view event handler. The event script is called when the camera view changes. The argument of the called function is stored in the _this variable and has as first element the new camera mode. Possible arguments are ["INTERNAL"], ["EXTERNAL"], ["GUNNER"] and ["GROUP"].

Argument:

  • 0: Code to execute (Code or String)

Return value:

  • ID of the event script (used to remove it later).

Example:

  • tbd

AGM_Core_fnc_removeCameraEventHandler

Author: commy2

Description:

  • Remove a camera view event handler.

Argument:

  • 0: ID of the event handler (Number)

Return value:

  • None.

Example:

  • tbd

AGM_Core_fnc_addCustomEventHandler

Author: commy2

Description:

  • Add a custom event to a unit. The event scripts are called by AGM_Core_fnc_callCustomEventHandlers.

Argument:

  • 0: Object the event should be assigned to (Object)
  • 1: Name of the event (String)
  • 2: Code to execute (Code or String)

Return value:

  • ID of the event script (used to remove it later).

Example:

  • My_wakeUp_EHID = [soldier1, "AGM_wokeUp", {hint format ["%1 just woke up from unconsciousness, name (_this select 0)]}] call AGM_Core_fnc_addCustomEventHandler;

AGM_Core_fnc_callCustomEventHandlers

Author: commy2

Description:

  • Execute all custom event script assigned to this object.

Argument:

  • 0: Object the event handlers are assigned to (Object)
  • 1: Name of the event (String)

Return value:

  • ID of the event script (used to remove it later).

Example:

  • tbd

AGM_Core_fnc_removeCustomEventHandler

Author: commy2

Description:

  • Remove a custom event handler from an object.

Argument:

  • 0: Unit the event handler is assigned to (Object)
  • 1: Name of the event (String)
  • 2: ID of the event handler (Number)

Return value:

  • None.

Example:

  • [soldier1, "wokeUp", My_wakeUp_EHID] call AGM_Core_fnc_removeCustomEventHandler

AGM_Core_fnc_addScrollWheelEventHandler

Author: commy2

Description:

  • Add an event handler that executes every time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number.

Argument:

  • 0: Code to execute (Code or String)

Return value:

  • ID of the event script (used to remove it later).

Example:

  • tbd

AGM_Core_fnc_removeScrollWheelEventHandler

Author: commy2

Decription:

  • Remove a scroll wheel event handler.

Argument:

  • 0: ID of the event handler (Number)

Return value:

  • None.

Example:

  • tbd

AGM_Interaction_fnc_addInteraction

Author: commy2

Description:

  • Add an AGM action to an object. Note: This function is global.

Argument:

  • 0: Object the action should be assigned to (Object)
  • 1: Name of the action shown in the menu (String)
  • 2: Distance the player can be away from the object (Number)
  • 3: Condition (Code or String)
  • 4: Statement (Code or String)
  • 5: Show the action even if the conditon is not met (Bool or Number)
  • 6: Priority (Number, optional default: 0)

Return value:

  • ID of the action (used to remove it later).

Example:

  • MY_Interaction_ID = [tank, "Test Action", 5, {true}, {hint "This is a tank"}, true] call AGM_Interaction_fnc_addInteraction;

AGM_Interaction_fnc_removeInteraction

Author: commy2

Description:

  • Remove an AGM action from an object. Note: This function is global.

Argument:

  • 0: Object (Object)
  • 1: ID of the action (Number)

Return value:

  • None.

Example:

  • [tank, MY_Interaction_ID] call AGM_Interaction_fnc_removeInteraction;

AGM_Interaction_fnc_addInteractionSelf

Author: commy2

Description:

  • Add an AGM self action to the player. Execute this on the local machine of the player.

Argument:

  • 0: Name of the action shown in the menu (String)
  • 1: Condition (Code or String)
  • 2: Statement (Code or String)
  • 3: Show the action even if the conditon is not met (Bool or Number)
  • 4: Priority (Number, optional default: 0)

Return value:

  • ID of the action (used to remove it later).

Example:

  • MY_SelfInteraction_ID = ["Test Interaction", {true}, {hint "Test"}, true] call AGM_Interaction_fnc_addInteractionSelf;

AGM_Interaction_fnc_removeInteractionSelf

Author: commy2

Decription:

  • Remove an AGM self action from the player.

Argument:

  • 0: ID of the action (Number)

Return value:

  • None.

Example:

  • [MY_SelfInteraction_ID] call AGM_Interaction_fnc_removeInteractionSelf;

AGM_Core_fnc_changeProjectileDirection

Author: commy2

Description:

  • Adjust a projectiles velocity and dir + up vector.

Argument:

  • 0: Projectile (Object, CfgAmmo)
  • 1: Adjust azimuth this much. (Number)
  • 2: Adjust inclination this much. (Number)
  • 3: Adjust projectile speed this much. In m/s. (Number, optional default: 0 m/s)

Return value:

  • None.

Example:

  • tbd

AGM_Core_fnc_codeToString

Author: commy2

Description:

  • Removes the brackets around a code and returns the code as a string. It does nothing if the code is already a string.

Argument:

  • 0: Code (Code or String)

Return value:

  • Code (String)

Example:

  • tbd

AGM_Core_fnc_displayTextStructured

Author: commy2

Description:

  • Display a structured text.

Argument:

  • 0: Text (Anything)
  • 1: Size of the textbox (Number, optional default: 1)

Return value:

  • Nothing

Example:

  • tbd

AGM_Core_fnc_displayTextPicture

Author: commy2

Description:

  • Display a structured text with image.

Argument:

  • 0: Text (Anything)
  • 1: Image (String)

Return value:

  • Nothing

Example:

  • tbd

AGM_Core_fnc_execRemoteFnc

Author: commy2

Description:

  • Execute a function on a remote machine in mp.

Argument:

  • 0: Function arguments (Array)
  • 1: Function to execute, has to be defined on the remote machine first (String)
  • 2: The function will be executed where this unit is local OR the mode were this function should be executed. (Object OR Number, optional default: 2)
  •  Mode 0: execute on this machine only
    
  •  Mode 1: execute on server
    
  •  Mode 2: execute on all clients + server
    
  •  Mode 3: execute on dedicated only
    

Return value:

  • Nothing

Example:

  • tbd

AGM_Core_fnc_filter

Author: KoffeinFlummi

Description:

  • Filters array and removes every element not fitting the condition

Arguments:

  • 0: Array to be filtered.
  • 1: Code to be evaluated.

Return Value:

  • Final array

Example:

  • [[0,1,2,3,4], {_this > 2}] call AGM_Core_fnc_filter ==> [3,4]

AGM_Core_fnc_map

Author: KoffeinFlummi

Description:

  • Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT.

Arguments:

  • 0: Array to be thingied.
  • 1: Code to be applied to every element.

Return Value:

  • Final array

Example:

  • [["2", "gobblecock", "25"], {parseNumber _this}] call AGM_Core_fnc_map ==> [2, 0, 25]

AGM_Core_fnc_getBinocular

Author: commy2

Description:

  • Returns the binocular of the unit. Empty string is returned, if the unit has no binocular.

Argument:

  • 0: Player (Object)

Return value:

  • Binocular (String)

Example:

  • [player] call AGM_Core_fnc_getBinocular;

AGM_Core_fnc_progressBar

Author: commy2

Description:

  • Draw progress bar and execute given function if succesful.

Argument:

  • 0: Duration of the action (Number)
  • 1: Arguments of the callback function (Array)
  • 2: Callback function name (String)
  • 3: Title of the loading bar (String)
  • 4: Name of the function that is called when the action is aborted via ESC (String, optional)

Return value:

  • Nothing

Example:

  • [5, [player], "{hint str (_this select 0)}", "Example progress bar"] call AGM_Core_fnc_progressBar;
  • [5, [player], "{hint str (_this select 0)}", "Example progress bar", "{hint 'Aboted'}"] call AGM_Core_fnc_progressBar;

As of v0.94.1 you can use the variable "_progress" to get the progression of the action up until the point it was aborted. Can be between 0 and 1.

  • [5, [player], "{hint str (_this select 0)}", "Example progress bar", "{hint str _progress}"] call AGM_Core_fnc_progressBar;

AGM_Core_fnc_toBin

Author: commy2

Description:

  • Converts number to binary number

Arguments:

  • 0: A number
  • 1: Min length of the return value (optional)

Return Value:

  • A binary number, String

Example:

  • [5] call AGM_Core_fnc_toBin; -> "101"
  • [5, 8] call AGM_Core_fnc_toBin; -> "00000101"

AGM_Core_fnc_toHex

Author: commy2

Description:

  • Converts number to hexadecimal number

Arguments:

  • 0: A number
  • 1: Min length of the return value (optional)

Return Value:

  • A hexadecimal number, String

Example:

  • [255] call AGM_Core_fnc_toHex; -> "FF"
  • [255, 8] call AGM_Core_fnc_toHex; -> "00FF"

AGM_Core_fnc_toNumber

Author: Garth de Wet (LH)

Description:

  • Takes a string/number and returns the number.

Arguments:

  • 0: TYPE - Value to attempt to convert to number or if number simply return number.

Return Value:

  • NUMBER

Example:

  • _number = ["102"] call AGM_Core_fnc_toNumber;

AGM_Core_fnc_numberToDigits

Author: commy2

Description:

  • Transforms a number to an array of the correspondending digits.

Argument:

  • 0: Number to 'digitize' (Number)
  • 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. (Number, optional)

Return value:

  • Digits. The maximum count is six digits. (Array)

Example:

  • [120] call AGM_Core_fnc_numberToDigits; -> [1,2,0]
  • [120, 4] call AGM_Core_fnc_numberToDigits; -> [0,1,2,0]

AGM_Core_fnc_numberToDigitsString

Author: commy2

Description:

  • Transforms a number to an string of the correspondending digits.

Argument:

  • 0: Number to 'digitize' (Number)
  • 1: Set the minimal length of the returned string. Useful for getting left hand zeroes. (Number, optional)

Return value:

  • Digits. The maximum length is six digits. (String)

Example:

  • [120] call AGM_Core_fnc_numberToDigitsString; -> "120"
  • [120, 4] call AGM_Core_fnc_numberToDigitsString; -> "0120"

AGM_Logistics_fnc_getPosLoadable

Author: PabstMirror

Description:

  • Returns the position of the object, OR he position of the transport in case the object is loaded into cargo.

Argument:

  • 0: Any object (Object)

Return value:

  • Position of the object or transport (Position 3D).

Example: [ammo_crate] call AGM_Logistics_fnc_getPosLoadable;


AGM_Drag_fnc_makeDraggable

Author: L-H

Description:

  • Initialises an object for drag usage. Ensure it is only run on one client or the server.

Argument:

  • 0: OBJECT - Object (static weapon, crate, etc.)
  • 1: BOOLEAN - Weight accounting if a crate (Default: true)

Return Value:

  • Nothing

Example:

  • if (isServer) then {this call AGM_Drag_fnc_makeDraggable;};

AGM_Drag_fnc_makeUndraggable

Author: L-H

Description:

  • Makes an object undraggable. Also reverses the effects of a AGM_Drag_fnc_makeDraggable call.

Argument:

  • 0: OBJECT - Object (static weapon, crate, etc.)
  • 1: BOOLEAN - Weight accounting if a crate (Default: true)

Return Value:

  • Nothing

Example:

  • [StaticWeapon2] call AGM_Drag_fnc_makeUndraggable;