PMC websites shut down September 13th 2025 unless yearly web hosting fees are paid. Please Support PMC to help keep these websites online.

Enjoyed or found this pages content useful, please Support PMC to help me keep this web page online beyond september 13th 2025 when yearly web hosting fees are due.

User Tools

Site Tools


arma:scripting

This is an old revision of the document!


Scripting

Scripting in ArmA is changed somewhat from OFP times.

Overview

ArmA has “” quotes for STRINGS only and {} curled braces for CODE only. Script commands doesn’t have to be in one line now with the curled braces. Command lines always end with ; instead of a ; *or* carriage return. So you can format code to be more readable

{
    if (condition) then
    {
        DoSomething1;
        DoSomething2;
        DoSomething3;
        DoSomething4;
        DoSomething5;
     };
} foreach array;

Instead of the terrible ofp classic

{if (condition) then {DoSomething1; DoSomething2; DoSomething3; DoSomething4; DoSomething5;};} foreach array;

Comments are no longer the same character as the end of command character.

// my comment
instead of
; my comment

You can use block comments now.

/*
  Comment line 1
  Comment line 2
  Comment line 3
  Comment line 4
  Comment line 5
  Comment line 6
*/

Quotes are no longer a valid substitute for braces.

Some SQF things

_resultArray = [0,""];
_handle = [_resultArray] execVM "resultScript.sqf";
// script runs and changes the _resultArray that is was given
waitUntil {scriptDone _handle};
_resultInt = _resultArray select 0;
_resultString = _resultArray select 1;

Misc PMC Example Scripts

Place random vehicles + some units on all found pmc_ gamelogics script, here.

arma/scripting.1184307727.txt.gz · Last modified: 2007/07/13 06:22 (external edit)