Introduction to Arma Scripting: Difference between revisions
(removed introduction headline and added scripting navbox) |
(Some scaffolding and groundwork for future changes) |
||
Line 5: | Line 5: | ||
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 | The solution for this is to take advantage of the game-engine's ability to employ an even more versatile feature known as scripting. Arma's scripting language [[SQF Syntax|SQF]] (and its predecessor [[SQS Syntax|SQS]] from {{ofp}}) can give you more direct control over core game features through [[:Category: Scripting Commands|script commands]] and [[:Category: Functions|scripted functions]]. | ||
== Before anything == | == Before anything == | ||
<!-- This section is not cool and should be reworked or removed --> | |||
; Is your idea necessary? | |||
: Will players even notice or use what you want to script? Just because you can does not mean you should. Sometimes less is more! | |||
; Is it possible to do this in the editor? | |||
: The [[Eden Editor]] is a powerful tool and with it alone one can achieve a lot of things without writing a single line of code. | |||
: Poorly written scripts are often the cause of poor performance both in singleplayer and multiplayer scenarios. | |||
; Can it be scripted using SQF? | |||
: This question might be hard to answer. Try to get as much information about what you want to do and what [[:Category: Scripting Commands|commands]] and [[:Category: Functions|functions]] there are before spending time on writing a script, just to find out that what you hoped to achieve is not possible after all. | |||
Depending on your answer for these questions, you may want to rethink your approach. | Depending on your answer for these questions, you may want to rethink your approach. | ||
{{Feature | Informative | | {{Feature|Informative|Scripting is <u>not</u> the solution for everything!}} | ||
== Terms == | == Terms == | ||
The following is a collection of terms frequently encountered when talking or reading about scripting. | |||
; Game Engine | |||
: The core program of the game which executes your scripting commands at run time. | |||
; Script <!-- meh --> | |||
: When speaking about a script, one is usually referring to a <tt>.sqs</tt> or <tt>.sqf</tt> [[Script (File)|script file]]. | |||
; Syntax <!-- TODO: Explanation --> | |||
: See [[SQF Syntax]] ({{arma}}, {{arma2}}, {{arma3}}, {{tkoh}}). | |||
: See [[SQS Syntax]] ({{ofp}}, {{arma}}). | |||
; Variables | |||
: A [[Variables|Variable]] is a named storage container for data. | |||
: The name of a variable is called its [[Identifier]]. | |||
; Data Types | |||
: The [[:Category: Data Types|Data Type]] of a variable specifies which kind of data that variable can contain. | |||
; Operators <!-- TODO: Explanation --> | |||
: See [[Operators]] | |||
; Control Structures <!-- TODO: Explanation --> | |||
: See [[Control Structures]] | |||
; Functions <!-- TODO: Explanation --> | |||
: See [[Function]] | |||
See [[Function | |||
== Recommended programs == | == Recommended programs == | ||
Code Edition programs can be found on the [[:Category:Community Tools#Code Edition|Community Tools - Code Edition]] page section. | |||
== Must-read articles == | == Must-read articles == | ||
<!-- Bad section title, should be changed --> | |||
=== Best Practices === | === Best Practices === | ||
See [[Code Best Practices]] | |||
=== Debugging === | === Debugging === | ||
* [[Debugging Techniques]] | * [[Debugging Techniques]] | ||
* [[:Category:Community_Tools#Debug_Console.2FSystem|Community Tools - Debug Console/System]] | * [[:Category:Community_Tools#Debug_Console.2FSystem|Community Tools - Debug Console/System]] | ||
=== Optimisation === | === Optimisation === | ||
* [[Code Optimisation]] | * [[Code Optimisation]] | ||
* [[Mission Optimisation]] | * [[Mission Optimisation]] | ||
Line 87: | Line 74: | ||
== Useful Links == | == Useful Links == | ||
These pages cover further aspects of scripting: | |||
These | |||
* [[:Category:Example Code|Example Code]] | * [[:Category:Example Code|Example Code]] | ||
* [[Control Structures]] | * [[Control Structures]] | ||
Line 97: | Line 83: | ||
* [[SQS to SQF conversion]] | * [[SQS to SQF conversion]] | ||
Consider the following resources for more general learning: | |||
* [[6thSense.eu/EG|6thSense.eu Editing Guide]] | * [[6thSense.eu/EG|6thSense.eu Editing Guide]] | ||
* [ | * [https://www.armaholic.com/page.php?id=20465 Fockers Arma 3 Scripting Guide] | ||
* [ | * [https://www.armaholic.com/page.php?id=4847 Mr-Murray's Armed Assault Editing Guide - Deluxe Edition] | ||
* [https://www.youtube.com/watch?v=WmEBN-RbK44 Excellent German SQF tutorial (YouTube)] | * [https://www.youtube.com/watch?v=WmEBN-RbK44 Excellent German SQF tutorial (YouTube)] | ||
[[Category:Arma Scripting Tutorials]] | [[Category:Arma Scripting Tutorials]] |
Revision as of 19:39, 25 February 2021
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 for this is to take advantage of the game-engine's ability to employ an even more versatile feature known as scripting. Arma's scripting language SQF (and its predecessor SQS from Operation Flashpoint) can give you more direct control over core game features through script commands and scripted functions.
Before anything
- Is your idea necessary?
- Will players even notice or use what you want to script? Just because you can does not mean you should. Sometimes less is more!
- Is it possible to do this in the editor?
- The Eden Editor is a powerful tool and with it alone one can achieve a lot of things without writing a single line of code.
- Poorly written scripts are often the cause of poor performance both in singleplayer and multiplayer scenarios.
- Can it be scripted using SQF?
- This question might be hard to answer. Try to get as much information about what you want to do and what commands and functions there are before spending time on writing a script, just to find out that what you hoped to achieve is not possible after all.
Depending on your answer for these questions, you may want to rethink your approach.
Terms
The following is a collection of terms frequently encountered when talking or reading about scripting.
- Game Engine
- The core program of the game which executes your scripting commands at run time.
- Script
- When speaking about a script, one is usually referring to a .sqs or .sqf script file.
- Syntax
- See SQF Syntax (Arma, Arma 2, Arma 3, Take On Helicopters).
- See SQS Syntax (Operation Flashpoint, Arma).
- Variables
- A Variable is a named storage container for data.
- The name of a variable is called its Identifier.
- Data Types
- The Data Type of a variable specifies which kind of data that variable can contain.
- Operators
- See Operators
- Control Structures
- See Control Structures
- Functions
- See Function
Recommended programs
Code Edition programs can be found on the Community Tools - Code Edition page section.
Must-read articles
Best Practices
Debugging
Optimisation
Useful Links
These pages cover further aspects of scripting:
- Example Code
- Control Structures
- Multiplayer Scripting
- Exception handling
- Script (File)
- Function
- SQS to SQF conversion
Consider the following resources for more general learning: