PMC websites shut down November 13th 2025 unless web hosting fees are paid. See up to date status from PMC Website Hosting and Domain Registration Fee Status forum topic. 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 November 13th 2025 when 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;
arma/scripting.1183550873.txt.gz · Last modified: 2007/07/10 09:52 (external edit)