Introduction to Arma Scripting
During mission editing and addon editing you will often come into the situation, where your imaginations can't be implemented using the native methods of the editors (f.i. cutscenes in missions, special animations in addons). The solution is either to learn more about the editor (f.i. advanced features and methods) or scripting.
Armed Assault's scripting language gives you the possibility of influencing the game engine. With any combination of so-called scripting commands you can create custom processes, that handle any specific needs and problems in a mission.
When Do I Need Scripting?
Scripting is primarily needed in user missions by the mission editor. The goal is to create processes that can't be done with the native features of the mission editor. So this is the first important check before you start scripting. Often the mission editor wants tiny features in a mission that arent't worth a script. Ask yourself, whether the user will notice and/or use the outcome of your script.
Be careful: Scripting isn't a solution to everything. The third step is to make sure, whether your needs can be implemented in the scripting language. This can be hard for a beginner, but if you made sure the two above steps, it will be possible in most of the cases. If you aren't sure - just ask in the official forums or at OFPEC.
Checklist
Here is a short summed up checklist of the above mentioned points:
- Can I do it with the native features? (mission editor, addon config files, ...)
- Will the player notice and/or use it?
- Is it possible?
If all of the three points are answered with "Yes", go on and script it! But be warned: It won't always be easy. ;-)
Scripting Code
what is it? where to put it? what are commands (doing)?
Layout
layout of code
- seperation by semicolons
conventions of code files
- one command per line in scripts and functions
- {} grouping code
- spaces or tabs to indent code
Comments
what are comments, where to use
- line comments
- block comments
Code Execution
how can I execute code? (external files vs. mission editor)
Mission Editor
how to execute code in the editor, listing of mission editor fields to start scripts
External Files
how to execute code in external files, scripts & functions
Developing a Script
script in this case: code in external files (scripts/functions). how to develop a script?
- Requirements
- Concept
- Implementation
- Test
usually in your head, for complex scripts on paper and drafts
Requirements
what shall the script do?
Concept
How shall the script do it?
Implementation
Writing the code
Test
Testing the code
What's next?
learning about scripts