arma2:scripting
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
arma2:scripting [2009/06/01 13:01] – added diag_log scripting command. snakeman | — | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Scripting ====== | ||
- | **initJIPcompatible.sqf** is automatically started at unknown time, best guess would be when JIP player joins? | ||
- | |||
- | |||
- | ====== Scripting Commands ====== | ||
- | |||
- | There' | ||
- | |||
- | Since ArmA 2 you must first initialize a variable before you reference it in your scripts. In ArmA, it was not a problem, at least for conditions. | ||
- | <code cpp> | ||
- | // this will error if myBoolean was not previously defined. | ||
- | if (myBoolean) then { hint " | ||
- | </ | ||
- | Usage of isNil is still valid. | ||
- | |||
- | |||
- | ===== BIS fnc locations ===== | ||
- | |||
- | BIS fnc locations | ||
- | |||
- | Description: | ||
- | |||
- | Upon registering, | ||
- | |||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | |||
- | If you're registering currently existing object and some of variables above is already stored in it, it won't be replaced. | ||
- | |||
- | Syntax | ||
- | |||
- | Syntax: [type(s), | ||
- | |||
- | Parameters: type(s): String or Array of strings\\ | ||
- | area: Array in format [center, | ||
- | debug: (Optional): Boolean | ||
- | |||
- | Return Value: Array - List of registered locations | ||
- | |||
- | Alternative Syntax | ||
- | |||
- | Syntax: [objects] call BIS_fnc_locations | ||
- | |||
- | Parameters: objects: Array of Objects or Locations - list of specific locations to be registered | ||
- | |||
- | Return Value: Array - List of registered locations | ||
- | |||
- | Examples | ||
- | |||
- | Example 1: | ||
- | <code cpp> | ||
- | [" | ||
- | </ | ||
- | |||
- | Example 2: | ||
- | <code cpp> | ||
- | [[" | ||
- | </ | ||
- | |||
- | Example 3: | ||
- | <code cpp> | ||
- | [[myLocation1, | ||
- | </ | ||
- | |||
- | See also: | ||
- | |||
- | Functions Library (above hehe) | ||
- | |||
- | ===== allowDamage ===== | ||
- | |||
- | Description: | ||
- | |||
- | Syntax: object allowDamage allow | ||
- | |||
- | Parameters: object: Object - allow: Boolean - | ||
- | |||
- | Example 1: | ||
- | <code cpp> | ||
- | player allowDamage false | ||
- | </ | ||
- | |||
- | |||
- | ===== setVariable ===== | ||
- | |||
- | setVariable now has a 3rd parameter: Global. | ||
- | |||
- | If you set the 3rd parameter to true, the variable will broadcast its value to every machine. | ||
- | <code cpp> | ||
- | _myObject setVariable [" | ||
- | </ | ||
- | |||
- | setVariable is now usable on any object, like groups for instance. This was not the case in ArmA. | ||
- | |||
- | |||
- | ===== uiNameSpace ===== | ||
- | |||
- | Working with UI related scripting commands, is not accepted in global or private variable space, and needs to be done inside uiNameSpace by using setVariable. | ||
- | |||
- | example: | ||
- | <code cpp> | ||
- | // set it | ||
- | uiNameSpace setVariable [" | ||
- | // use it | ||
- | ctrl.... (uiNameSpace getVariable " | ||
- | </ | ||
- | |||
- | |||
- | ===== createDiaryRecord ===== | ||
- | |||
- | createDiaryRecord | ||
- | |||
- | <code cpp> | ||
- | _diary = player createDiaryRecord [" | ||
- | </ | ||
- | |||
- | |||
- | ===== createSimpleTask ===== | ||
- | |||
- | createSimpleTask | ||
- | |||
- | <code cpp> | ||
- | task1 = player createSimpleTask [" | ||
- | </ | ||
- | |||
- | |||
- | ===== setSimpleTaskDescription ===== | ||
- | |||
- | setSimpleTaskDescription | ||
- | |||
- | <code cpp> | ||
- | task1 setSimpleTaskDescription [" | ||
- | </ | ||
- | |||
- | |||
- | ===== setSimpleTaskDestination ===== | ||
- | |||
- | setSimpleTaskDestination | ||
- | |||
- | <code cpp> | ||
- | task1 setSimpleTaskDestination markerPos " | ||
- | </ | ||
- | |||
- | |||
- | ===== setTaskState ===== | ||
- | |||
- | setTaskState | ||
- | |||
- | <code cpp> | ||
- | task1 setTaskState " | ||
- | </ | ||
- | |||
- | |||
- | ===== setCurrentTask ===== | ||
- | |||
- | setCurrentTask | ||
- | |||
- | <code cpp> | ||
- | player setCurrentTask task1; | ||
- | </ | ||
- | |||
- | |||
- | ===== attachTo ===== | ||
- | |||
- | attachTo, see also detach. | ||
- | |||
- | <code cpp> | ||
- | // Make player float exactly 2m above center of car, automatically changing vectordir + relative position as car moves. | ||
- | player attachTo [car, [0,0,2]]; | ||
- | detach player; | ||
- | </ | ||
- | |||
- | |||
- | ===== diag_log ===== | ||
- | |||
- | diag_log writes any variable ([_fish, _frog] or " |
arma2/scripting.txt · Last modified: 2024/08/01 22:38 by snakeman