Code vs. Strings: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "paramaters" to "parameters")
m (Add Columns template usage)
Line 12: Line 12:


== Code Commands ==
== Code Commands ==
'''Code commands''' are any commands from the scripting language expecting a coded statement string as one of their parameters. Earlier engines accepted code as such when it was provided as a [[String]] using quotation marks, ''or'' using braces. Since Armed Assault the engine <i>specifically</i> requires braces. Thus, because the way the engine determines whether it is dealing with code has changed, this list is presented here.
'''Code commands''' are any commands from the scripting language expecting a coded statement string as one of their parameters. Earlier engines accepted code as such when it was provided as a [[String]] using quotation marks, ''or'' using braces. Since Armed Assault the engine '''specifically''' requires braces. Thus, because the way the engine determines whether it is dealing with code has changed, this list is presented here.


Commands passed as data type [[Code]]: Last updated: {{GVI|arma3|2.01}}
Commands passed as data type [[Code]]: Last updated: {{GVI|arma3|2.02}}
<div style="columns: 3">
{{Columns|3|
* [[apply]]
* [[and]]
* [[in]]
* [[&&]]
* [[&&]]
* [[a or b|||]]
* [[a or b|||]]
* [[if]]
* [[addPublicVariableEventHandler]]
* [[then]]
* [[and]]
* [[try]]
* [[apply]]
* [[call]]
* [[catch]]
* [[catch]]
* [[collect3DENHistory]]
* [[count]]
* [[count]]
* [[default]]
* [[deleteAt]]
* [[do]]
* [[else]]
* [[exitWith]]
* [[findIf]]
* [[forEachMemberAgent]]
* [[forEachMemberTeam]]
* [[forEachMember]]
* [[forEach]]
* [[forEach]]
* [[forEach]]
* [[for]]
* [[get]]
* [[get]]
* [[if]]
* [[in]]
* [[isFinal]]
* [[isNil]]
* [[onCommandModeChanged]]
* [[onEachFrame]]
* [[onGroupIconClick]]
* [[onGroupIconOverEnter]]
* [[onGroupIconOverLeave]]
* [[onHCGroupSelectionChanged]]
* [[onMapSingleClick]]
* [[onMapSingleClick]]
* [[findIf]]
* [[onPlayerConnected]]
* [[switch]]
* [[onPlayerDisconnected]]
* [[spawn]]
* [[onPreloadFinished]]
* [[call]]
* [[onPreloadStarted]]
* [[else]]
* [[onTeamSwitch]]
* [[addPublicVariableEventHandler]]
* [[forEachMember]]
* [[if]]
* [[exitWith]]
* [[or]]
* [[or]]
* [[select]]
* [[select]]
* [[deleteAt]]
* [[spawn]]
* [[while]]
* [[do]]
* [[with]]
* [[do]]
* [[for]]
* [[do]]
* [[switch]]
* [[switch]]
* [[do]]
* [[then]]
* [[forEachMemberAgent]]
* [[forEachMemberTeam]]
* [[onPlayerDisconnected]]
* [[toString]]
* [[toString]]
* [[onHCGroupSelectionChanged]]
* [[onPreloadStarted]]
* [[while]]
* [[try]]
* [[try]]
* [[onGroupIconOverEnter]]
* [[onCommandModeChanged]]
* [[waitUntil]]
* [[waitUntil]]
* [[onMapSingleClick]]
* [[while]]
* [[onEachFrame]]
* [[with]]
* [[onPreloadFinished]]
}}
* [[call]]
* [[isNil]]
* [[default]]
* [[collect3DENHistory]]
* [[onGroupIconOverLeave]]
* [[isFinal]]
* [[onPlayerConnected]]
* [[onGroupIconClick]]
* [[onTeamSwitch]]
</div>


== String Commands ==
== String Commands ==
Commands passed as data type [[String]]:
Commands passed as data type [[String]]:
*map [[onDoubleClick]] "[[Code]]"
* map [[onDoubleClick]] "[[Code]]"
*map [[onMapSingleClick]] "[[Code]]
* map [[onMapSingleClick]] "[[Code]]"
 


[[Category: Scripting Topics]]
[[Category: Scripting Topics]]

Revision as of 18:19, 14 June 2021

Since Armed Assault the convention to use quotation marks for Strings and curly braces for Code has been formalised. Exceptions, however, do exist. For example onMapSingleClick and onDoubleClick.
When scripting 'abc', "abc" or ""abc"" generally indicates data type String, and { } indicates data type Code.

In Operation Flashpoint many language constructs (including forEach, if, while) use the concept of "code strings". Code is passed as a string to them and they interpret it as code if they wish. Since version 1.85, string constants can be written in two ways:

Using

  • double quotes: "Hello"

or

  • curled braces {a=a+1}

A partial list of commands which expect code as parameter is provided at Code Commands.

Code Commands

Code commands are any commands from the scripting language expecting a coded statement string as one of their parameters. Earlier engines accepted code as such when it was provided as a String using quotation marks, or using braces. Since Armed Assault the engine specifically requires braces. Thus, because the way the engine determines whether it is dealing with code has changed, this list is presented here.

Commands passed as data type Code: Last updated: Arma 3 logo black.png2.02

String Commands

Commands passed as data type String: