Oxygen 2 Misc Documentation

From Bohemia Interactive Community
Revision as of 18:43, 4 January 2023 by Lou Montana (talk | contribs) (Text replacement - "{{HashLink" to "{{Link")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page is a list of found Oxygen 2 avilable commands and behaviours.

O2 Script

if then else

if (something == 1) then {fred=1;}else{fred=2;};


  private ["_in","_out"];
  if (_in== 1) then {_out=1;}else{_out=2;};
  out   // lack of semi colon returns content of out


  if (_in== 1) then {1}else{2}; // achieves same


comment "comment" /* comments

  • /

// comments

messageBox [text,nButtons]

Returns ID of pressed button

Shows message box with text and buttons.

nButtons is undocumented but probably follows the msoft conventions of ok, cancel, blah, + warning icons

nButtons 0: == OK only



 if (isnil "_exists") ExitWith(_file_exists=false;};
 if (!isnil "_exists") ExitWith(_file_exists=true;};

note that exitwith is pretty close to useless it ONLY breaks out of the current braces, not, out of a subroutine per se



 _dirs= shellCmdOpenPipe("....

File Commands


See SetCD below.


_folder=GetCD; // returns fully qualified (P:\etc)


   Opens stream for standard input and output. If no standard I/O is assigned, creates console, and redirect I/O into console. Note: Always assign result to variable, and access stream with variable.


   console=openStandardIO; console<<"Hallo world"

console=nil; close it

openFile ["filename",mode]

  • Returns IOStream

Opens or creates a file specified by filename. Mode contain one of following values:

  • 0 - test existence of file (no open)
  • 1 - open existing file for reading
  • 2 - create new file for writting
  • 3 - open existing file for reading and writting
  • 4 - open (create if not exists) file for reading and writting


_file=openFile ["some\file\anywhere.ext",0];
if (!isnil("_file")) then {do_something;_file=nil;};

Note: _file will be non nil for mode 0

shellCmd "command"

Retursn: Result (number)

Function waits until command is finished

result is -1 if file not found, or cannot be started, otherwise returns application's exit code


   _result = shellCmd ("notepad.exe");

shellCmdOpenPipe "command"

Returns IOStream

Creates bi-directional pipe to the new process. Script can use this pipe to send commands to child process and read its results


_files=shellCmdOpenPipe ("dir /b/a:-d-h/L *.p3d"); list only p3d files in lower case, no hidden stuff
while "!eof _files" do 
 _filename= getline _files;
 if (_filename!="") then {[_filename] call something;};

SplitPath "Path"

Returns the Path string into a 4 element array



   splitPath "C:\test\anywhere\anyFile.txt" , result is ["c:","\test\anywhere","anyFile",".txt"]

this command does not work as nature intended

the drive is force-set to current drive

the folder path is determined by current directory

a lack of preceding slash adds it. any drive specification in the string (such as proxy:) is treated as folder path (part of)