Introduction to Arma Scripting: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add categories and Mission Optimisation link)
m (Spacing)
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{SideTOC}}
{{SideTOC}}
{{Informative|This page is WIP. Feel free to contribute!}}
{{wip}}


== Introduction ==
== Introduction ==
Line 8: Line 8:
During [[ArmA: Mission Editing|mission editing]] and [[ArmA: Addon Editing|addon editing]] you may come across situations where actions or features you would like to have in your mission or addon cannot be accomplished using the basic (or even the more advanced) capabilities of the [[ArmA: Mission Editor|mission editor]] or within config files (in the case of addons). Some examples of this might be really cinematic cutscenes in missions or special animations for an addon.
During [[ArmA: Mission Editing|mission editing]] and [[ArmA: Addon Editing|addon editing]] you may come across situations where actions or features you would like to have in your mission or addon cannot be accomplished using the basic (or even the more advanced) capabilities of the [[ArmA: Mission Editor|mission editor]] or within config files (in the case of addons). Some examples of this might be really cinematic cutscenes in missions or special animations for an addon.


The '''solution''' to this is to take advantage of the game-engines ability to call on an even more advanced feature known as [[Scripting|scripting]]. [[Armed Assault|Armed Assault's]] '''scripting language''' gives you more direct control of core game commands. With any combination of these [[:Category:ArmA: Scripting Commands|scripting commands]] you can then create custom processes that meet the specific needs of your mission or addon.
The '''solution''' to this is to take advantage of the game-engines ability to call on an even more advanced feature known as [[Scripting|scripting]]. [[Armed Assault|Armed Assault's]] '''scripting language''' gives you more direct control of core game commands. With any combination of these '''[[:Category: Scripting Commands|commands]]''' and '''[[:Category: Functions|functions]]''' you can then create custom processes that meet the specific needs of your mission or addon.




Line 28: Line 28:


'''Syntax''':
'''Syntax''':
See [[SQF syntax]]
* See [[SQF syntax]]
See [[SQS syntax]]
* See [[SQS syntax]] (obsolete)


'''Script''':
'''Script''':
Line 62: Line 62:




== Recommended programms ==
== Recommended programs ==


The following programms are recommended when working with sqf, sqs, cpp or many other file types. Most of them offer syntax highlighting and other useful features. Check them out and select the one you like the most.
The following programms are recommended when working with sqf, sqs, cpp or many other file types. Most of them offer syntax highlighting and other useful features. Check them out and select the one you like the most.


*[https://notepad-plus-plus.org/ Notepad++]
* [https://code.visualstudio.com/download Visual Studio Code] (with SQF plugin)
*[http://www.geany.org/ Geany]
* [https://notepad-plus-plus.org/ Notepad++]
*[https://atom.io/ Atom]
* [http://www.geany.org/ Geany]
*[[Poseidon Tools]]
* [https://atom.io/ Atom]
*[https://www.eclipse.org/ Eclipse] with [https://forums.bohemia.net/forums/topic/202181-sqdev-sqf-developing-in-eclipse/ SQDev]
* [[Poseidon Tools]]
* [https://www.eclipse.org/ Eclipse] with [https://forums.bohemia.net/forums/topic/202181-sqdev-sqf-developing-in-eclipse/ SQDev]
<!--
<!--
== The Concept ==
== The Concept ==
Line 95: Line 96:
== Scripting Code ==
== Scripting Code ==


The core of scripting is '''scripting code'''. The code consists of [[:Category:ArmA: Scripting Commands|scripting commands]] that tell the game engine what to do. These commands are executed one after another.
The core of scripting is '''scripting code'''. The code consists of [[:Category:Scripting Commands|scripting commands]] that tell the game engine what to do. These commands are executed one after another.


The code is written into special fields of the [[ArmA: Mission Editor|mission editor]] (see below) or into separate files that are executed at some defined point (i.e. through [[Triggers|triggers]]) during the running mission.
The code is written into special fields of the [[ArmA: Mission Editor|mission editor]] (see below) or into separate files that are executed at some defined point (i.e. through [[Triggers|triggers]]) during the running mission.
Line 141: Line 142:
== Code Execution ==
== Code Execution ==


how can I execute code? (external files vs. mission editor)  
how can I execute code? (external files vs. mission editor)


=== Mission Editor ===
=== Mission Editor ===
Line 174: Line 175:
Writing the code
Writing the code
-->
-->
== Best Practices ==
* [[Code Best Practices]]




Line 184: Line 190:


* [[Code Optimisation]]
* [[Code Optimisation]]
* [[Mission Optimisation]]




Line 189: Line 196:


These links offer a great deal of information about [[Scripting]]:
These links offer a great deal of information about [[Scripting]]:
* [[:Category:Example Code|Example Code]]
* [[Control Structures]]
* [[Control Structures]]
* [[Multiplayer Scripting]]
* [[Multiplayer Scripting]]
* [[Mission Optimisation]]
* [[Exception handling]]
* [[Exception handling]]
* [[Script (File)]]
* [[Script (File)]]

Revision as of 20:59, 12 September 2019

Template:SideTOC Template:wip

Introduction

This page should give beginners an overview of how to begin with scripting and where to find most of the information they need in the beginning. Some information might not be complete and can be found on other wiki pages.

During mission editing and addon editing you may come across situations where actions or features you would like to have in your mission or addon cannot be accomplished using the basic (or even the more advanced) capabilities of the mission editor or within config files (in the case of addons). Some examples of this might be really cinematic cutscenes in missions or special animations for an addon.

The solution to this is to take advantage of the game-engines ability to call on an even more advanced feature known as scripting. Armed Assault's scripting language gives you more direct control of core game commands. With any combination of these commands and functions you can then create custom processes that meet the specific needs of your mission or addon.


Terms

Before getting started, you should understand the meaning of these terms.

Data Types: See Data Types

Algorithm: In mathematics and computer science, an algorithm is an explicit specification of how to solve a class of problems. Algorithms can perform calculation, data processing and automated reasoning tasks.

Interpreter: Reads your code from a script file and translates it into instructions for you to achieve your desired outcome/effect in the game.

Control Structures: See Control Structures

Syntax:

Script: When speaking about a script, we usually mean a .sqs or .sqf file.

Game Engine: The core program of the game which reads and executes your scripting commands at run time.

Function: See Function

Variables: See Variables

Operators: See Operators


Recommended programs

The following programms are recommended when working with sqf, sqs, cpp or many other file types. Most of them offer syntax highlighting and other useful features. Check them out and select the one you like the most.


Best Practices


Debugging


Optimisation


Useful Links

These links offer a great deal of information about Scripting:

Additionally, the following are more resources for more general learning: