User Tools

Site Tools


arma:scripting

This is an old revision of the document!


Table of Contents

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 Scripts

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

arma/scripting.1184307500.txt.gz · Last modified: 2007-07-13 06:18 by snakeman