Code: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎Introduction: better explanation?)
mNo edit summary
Line 1: Line 1:
==Introduction==
'''Code''' is a string like <u>paramater</u> passed or used by '''some''' of the scripting commands. [[addEventHandler|AddEventHandler]] eg [[onMapSingleClick|OnMapSingleClick]] eg.
'''Code''' is a string like <u>paramater</u> passed or used by '''some''' of the scripting commands. [[addEventHandler|AddEventHandler]] eg [[onMapSingleClick|OnMapSingleClick]] eg.


Line 11: Line 8:




[[ArmA|Armed Assault]] formalised this 'convention' by creating a Code '''Type'''. In previous versions it was a prefered style to write such strings in curled braces, but it was also possible to write them in quotation marks (exactly like [[String]]s). ArmA functions that are marked as requiring '''Code''' must be presented with curled braces.
[[ArmA|Armed Assault]] formalised this 'convention' by creating a Code '''Type'''. In previous versions it was a prefered style to write such strings in curled braces, but it was also possible to write them in quotation marks (exactly like [[String]]s). ArmA commands that are marked as requiring '''Code''' must be presented with curled braces. Resistance / Cold War crisis commands using a '''Code''' style paramater should ''also'' used curled brace as a good writing style that was adopted very early on by most mission makers.
 
==Description==
 
Part of code (compiled), in curled braces:
 


==Examples==
==Examples==

Revision as of 23:40, 4 September 2007

Code is a string like paramater passed or used by some of the scripting commands. AddEventHandler eg OnMapSingleClick eg.


The text body that makes up Code are also scripting commands. Eg commands that will be executed 'at some time'.


Code should be represented by enclosing curly brace. { code.... }


Armed Assault formalised this 'convention' by creating a Code Type. In previous versions it was a prefered style to write such strings in curled braces, but it was also possible to write them in quotation marks (exactly like Strings). ArmA commands that are marked as requiring Code must be presented with curled braces. Resistance / Cold War crisis commands using a Code style paramater should also used curled brace as a good writing style that was adopted very early on by most mission makers.

Examples

{_x setDamage 1} forEach ArrayToKill