User Tools

Site Tools


arma2:scripting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
arma2:scripting [2011-07-24 08:36]
snakeman added basics_of_sqf link.
arma2:scripting [2015-06-08 02:24] (current)
Line 1: Line 1:
-====== Scripting ======+====== ​ArmA 2 Scripting ======
  
 ArmA 2 will be largely compatible with Armed Assault. To make porting of content from ArmA as simple as possible, there are few important things: ArmA 2 will be largely compatible with Armed Assault. To make porting of content from ArmA as simple as possible, there are few important things:
Line 9: Line 9:
   * in order to maintain smooth frame rate in real-time content, time limit for all scripts in each frame is enforced by the engine in ArmA 2. Generally speaking, in case of more demanding scripts, be prepared that their result may come way later and also there probably can suffer from significant latency. It is under evaluation if and how possibly allow user scripts to change how much time they may take from the CPU in every frame.   * in order to maintain smooth frame rate in real-time content, time limit for all scripts in each frame is enforced by the engine in ArmA 2. Generally speaking, in case of more demanding scripts, be prepared that their result may come way later and also there probably can suffer from significant latency. It is under evaluation if and how possibly allow user scripts to change how much time they may take from the CPU in every frame.
  
-  * SQS script format will be fully supported in ArmA 2.+  * SQS script format will be fully supported in ArmA 2 (but they should never be used).
  
-**initJIPcompatible.sqf** is automatically started at unknown timebest guess would be when JIP player joins?+**initJIPcompatible.sqf** ​initJIPcompatible.sqf gets called from the MP mission framework (scripts in modules MP directory). A script waits until the player object ​is initialized and execs initJIPcompatible.sqf on clients (all clientseven those that were allready there at mission start as it is basically the same). Has nothing todo with init.sqf.
  
 [[arma2:​scripting:​basics_of_sqf|Basics of SQF]] [[arma2:​scripting:​basics_of_sqf|Basics of SQF]]
Line 23: Line 23:
 [[arma2:​scripting:​ied_usage|IED usage]] improvised explosive device usage through script. [[arma2:​scripting:​ied_usage|IED usage]] improvised explosive device usage through script.
  
 +Few more [[arma2:​scripting:​comref|Scripting command reference]] items.
  
-====== Scripting Commands ======+[[arma2:​scripting:​common_scripting_errors|Common scripting errors]] help you to debug your code.
  
-There'​s a lot of cool scripts (functions) available in Modules.pbo - especially under "​Functions"​ and even an multiplayer Framework in "​MP"​. +[[arma2:​scripting:​group_in_vehicle|Group in Vehicle]] check.
- +
-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 "​test"​ }; +
-</​code>​ +
-Usage of isNil is still valid. +
- +
-Few more [[arma2:​scripting:​comref|Scripting command reference]] items.+
  
 +[[arma2:​scripting:​bis_fnc_spawngroup|BIS_fnc_spawnGroup]] how to create whole groups from CfgGroups class.
  
-====== taskHint.sqf ======+[[arma2:​scripting:​bis_fnc_findsafepos|BIS_fnc_findSafePos]] how to find safe position with open ground etc.
  
-How to make task hints+Global scripts dir or common scripts dir is very useful. This feature has been known since OFP, check out the details from [[arma:​scripting#​global_scripts_dir|ArmA:​ Scripting - Global scripts dir]], as same feature works in ArmA 2.
  
-taskHint is relatively useless itself (because it requires too much effort), but there is a script that makes it easier to use. So instead of executing a hint, do this: +Howto create and use [[arma2:​scripting:​object-compositions|Object Compositions]in missions.
-<code cpp> +
-[objNull, objNull, tskExample1,​ "​SUCCEEDED"​execVM "​CA\Modules\MP\data\scriptCommands\taskHint.sqf";​ +
-</​code>​+
  
-The first 2 arguments are useless so i just send objNull, the 3rd is the task that you've created, and the 4th is the status.+[[arma2:​scripting:​addpublicvariableeventhandler|addPublicVariableEventhandler]] examples.
  
-Supported task states"​CREATED",​ "​CURRENT",​ "​CANCELED",​ "​SUCCEEDED"​ and "​FAILED"​.+[[arma2:scripting:​benchmark-cutscene|Benchmark Cutscene]]
  
-  * This command does not set the state of the task, so you still need to do this command, and the setTaskState command in your trigger. +[[arma2:​scripting:​enablesaving|enableSaving]] and why its useful ​to disable.
-  * It creates the hint in the middle of the screen, not at the right side (this means that taskHint and hint can be used at the same time).+
arma2/scripting.1311496599.txt.gz · Last modified: 2011-07-24 08:36 (external edit)