Introduction to Arma Scripting: Difference between revisions
Lou Montana (talk | contribs) m (Spacing) |
Lou Montana (talk | contribs) (Page slight filling, WIP removal) |
||
Line 1: | Line 1: | ||
{{SideTOC}} | {{SideTOC}} | ||
== Introduction == | == Introduction == | ||
Line 8: | Line 6: | ||
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- | The '''solution''' to this is to take advantage of the game-engine's ability to call on an even more advanced feature known as [[Scripting|scripting]]. '''Arma''''s '''scripting language''' gives you a more direct control of core game features. With any combination of these '''[[:Category: Scripting Commands|commands]]''' and '''[[:Category: Functions|functions]]''' you can create custom processes that meet the specific needs of your mission or addon. | ||
== Before anything == | |||
=== Is your idea necessary? === | |||
* Will players even notice or use what you want to script? Just because you can doesn’t mean you should. Sometimes less is more! | |||
=== Is it possible to do this in the editor? === | |||
* [[Eden Editor]] is an incredibly powerful tool and with it alone one can achive a lot of things, even without writing a single line of [[SQF syntax|SQF]]. | |||
* ''Poorly written'' scripts are often the reason for poor performance both in singleplayer and multiplayer scenarios. | |||
=== Can it be scripted using SQF? === | |||
* This might be hard to answer, especially for beginners. 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 it is ''not'' possible in the end. | |||
Should any question above be answered with '''"Yes"''', you may want to rethink your approach. | |||
{{Informative | '''Scripting''' is <u>not</u> a solution to everything.}} | |||
Line 45: | Line 64: | ||
'''Operators''': | '''Operators''': | ||
See [[Operators]] | See [[Operators]] | ||
== Recommended programs == | == Recommended programs == | ||
'''Code Edition''' programs can be found on the [[:Category:Community Tools#Code Edition|Community Tools - Code Edition]] page section. | |||
Code | |||
== Must-read articles == | |||
= | === Best Practices === | ||
== Best Practices == | |||
* [[Code Best Practices]] | * [[Code Best Practices]] | ||
=== Debugging === | |||
== Debugging == | |||
* [[Debugging Techniques]] | * [[Debugging Techniques]] | ||
* [[:Category:Community_Tools#Debug_Console.2FSystem|Community Tools - Debug Console/System]] | |||
=== Optimisation === | |||
== Optimisation == | |||
* [[Code Optimisation]] | * [[Code Optimisation]] | ||
Line 205: | Line 100: | ||
Additionally, the following are more resources for more general learning: | Additionally, the following are more resources for more general learning: | ||
* [[6thSense.eu | * [[6thSense.eu/EG|6thSense.eu Editing Guide]] | ||
* [http://www.armaholic.com/page.php?id=20465 Fockers Arma 3 Scripting Guide] | * [http://www.armaholic.com/page.php?id=20465 Fockers Arma 3 Scripting Guide] | ||
* [http://www.armaholic.com/page.php?id=4847 Mr-Murray's Armed Assault Editing Guide - Deluxe Edition] | * [http://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] | * [https://www.youtube.com/watch?v=WmEBN-RbK44 Excellent German SQF tutorial (YouTube)] | ||
[[Category:Scripting Topics]] | [[Category:Scripting Topics]] | ||
Line 215: | Line 111: | ||
[[Category:ArmA 2: Editing]] | [[Category:ArmA 2: Editing]] | ||
[[Category:Arma 3: Editing]] | [[Category:Arma 3: Editing]] | ||
[[Category:Take On Helicopters: Editing]] |
Revision as of 23:30, 2 December 2019
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-engine's ability to call on an even more advanced feature known as scripting. Arma's scripting language gives you a more direct control of core game features. With any combination of these commands and functions you can create custom processes that meet the specific needs of your mission or addon.
Before anything
Is your idea necessary?
- Will players even notice or use what you want to script? Just because you can doesn’t mean you should. Sometimes less is more!
Is it possible to do this in the editor?
- Eden Editor is an incredibly powerful tool and with it alone one can achive a lot of things, even without writing a single line of SQF.
- Poorly written scripts are often the reason for poor performance both in singleplayer and multiplayer scenarios.
Can it be scripted using SQF?
- This might be hard to answer, especially for beginners. 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 it is not possible in the end.
Should any question above be answered with "Yes", you may want to rethink your approach.
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:
- See SQF syntax
- See SQS syntax (obsolete)
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
Code Edition programs can be found on the Community Tools - Code Edition page section.
Must-read articles
Best Practices
Debugging
Optimisation
Useful Links
These links offer a great deal of information about Scripting:
- Example Code
- Control Structures
- Multiplayer Scripting
- Exception handling
- Script (File)
- Function
- SQS to SQF conversion
Additionally, the following are more resources for more general learning: