On-Line doc

Fwatch v1.11 scripting documentation

Usage instructions

Fwatch hooks file accesses made by OFP which allows you to make calls to Fwatch from OFP scripts. All commands for fwatch start with character ':', followed by a script command and possible parameters for it.

You can use addAction, exec, loadFile and preprocessFile commands from OFP to call Fwatch, for example:

Display fwatch version:
hint loadFile ":info version"

Execute script from http://www.site.domain/something.sqs:
[] exec ":file wget http://www.site.domain/something.sqs"

Conver _string to lower case:
_string = call loadFile format[{:string tolower "%1"}, _string]


Fwatch modifies (in memory) one string from "stringtable.csv". This serves as a presence check. The condition is:

_present = localize "STR_USRACT_CHEAT_1" == "FWATCH"
? _present : goto "FwatchON"

#FwatchOFF
; Do things without Fwatch
exit

#FwatchON
; Do things that require Fwatch here
It will work as long as the basic structure of the stringtable file remain unchanged. In other case use original "stringtable.csv".



General notes

Using strings

Strings should always be in quotation marks, ie:
good:

_x = call loadFile format[{:string tolower "%1"}, "HELLO"]
_x = call loadFile format[{:string tolower "%1"}, _mystring]
_x = call loadFile format[{:string tolower "HELLO"}]
_x = call loadFile format[":string tolower ""HELLO"""]
bad:
_x = call loadFile format[":string tolower HELLO"]
_x = call loadFile format[{:string tolower %1}, "HELLO"]
_x = call loadFile format[":string tolower %1", "HELLO"]


Filenames

Files are saved in the fwatch/mdb/ directory, all slashes and other invalid characters will be replaced with an underscore in file operations, ie:

call loadFile format[":file write /etc/passwd foo 1"]
would save foo=1 to fwatch/mdb/_etc_passwd

all filenames will be automatically converted to lower case.

You should always use unique filenames in file operations for you missions as missions can read, write and delete files from each other, ie:
good:

call loadFile format[":file write KEG_losthope_savegame.db foo 1"]
call loadFile format[":file write Kegetys_0001_savegame.db foo 1"]
call loadFile format[{:file write "KEG_%1_savegame.db" %2 %3}, missionName, "foo", foo]
bad:
call loadFile format[":file write savegame.db foo 1"]


General

OFP will crash if you try to call Fwatch with a filename longer than 127 characters.

Be careful with the usage of file wget, especially in multiplayer missions as it can easily cause large amounts of requests to the web server. For example if you do a request at the start of a MP mission, running the script on all players in a 20 player multiplayer game there will instantly be 21 requests made to the web server once the mission starts.

Pay special attention to where you need to run the scripts in a multiplayer game, for example if you are saving a variable to a file it maybe isn't necessary to save it anywhere else than in the server machine.

The asynchronous input commands do not know what script called them, so having multiple scripts running at the same time using them can cause keystrokes to be missed.



Command list:

FILE IGSE INFO INPUT MEMORY RESTART SPIG STRING
file awrite i info date input agetkey
mem getcam restart client spig exe s
file delete il info debugout input agetkeys mem getcinemaborder restart server sc
file dxdll in info version input getjoystick mem getcursor se
file exists io input getkey mem getdate sf
file list ip input getkeys mem getdaylight sr
file modlist ir input getmouse mem getgraphics st
file qwrite input lock mem getjoystick string first
file read input setmouse mem getmap string index
file read2 mem getnv string last
file readvars mem getoptics string length
file remove mem getplayeranim string range
file renamemissions mem getplayerview string toarray
file vars mem getrespawntype string tolower
file wget mem getresside string toupper
file write mem getscroll sv
mem getworld
mem setbrightness
mem setcloudlets
mem setcursor
mem setmap
mem setoptics
mem setplayeranim
mem setplayerview
mem setrespawntype
mem setviewdistance
mem setvquality




Command reference

commanddescription

info version Return script engine version

Input: nothing
Output: float
Version: 1.0
example:
_x = call loadFile ":info version"
Value of _x would be 1.0 with fwatch v1.0

info debugout Output Win32 debug string

Input: string
Output: integer ("1")
Version: 1.0
example:
call loadFile ":info debugout testing"

string first str1 str2 Return the index in str2 of the first occurrence of str1, or -1 if str1 is not found.

Input: 1:string occurence   2:string search in
Output: integer
Version: 1.0
example:
_x = call loadFile format[{:string first "%1" "%2"}, "foo", "xx foo yy foo"]
Value of _x would be 4

string last str1 str2 Return the index in str2 of the last occurrence of str1, or -1 if str1 is not found.

Input: 1:string occurence   2:string search in
Output: integer
Version: 1.0
example:
_x = call loadFile format[{:string last "%1" "%2"}, "foo", "xx foo yy foo"]
Value of _x would be 11

string index string idx Return the character at the specified idx.

Input: 1:string text   2:integer position
Output: string
Version: 1.0
example:
_x = call loadFile format[{:string index "%1" 1}, "hello"]
Value of _x would be "e"

string length string Return the number of characters in string.

Input: string
Output: integer
Version: 1.0
example:
_x = call loadFile format[{:string length "%1"}, "hello"]
Value of _x would be 5

string range str i j Return the range of characters in str from i to j.

Input: 1:string text   2:integer start   3:integer end
Output: string
Version: 1.0
example:
_x = call loadFile format[{:string range "%1" 1 4}, "hello"]
Value of _x would be "ell"

string tolower string Return string in lower case.

Input: string
Output: string
Version: 1.0
example:
_x = call loadFile format[{:string tolower "%1"}, "HELLO"]
Value of _x would be "hello"

string toupper string Return string in upper case.

Input: string
Output: string
Version: 1.0
example:
_x = call loadFile format[{:string toupper "%1"}, "hello"]
Value of _x would be "HELLO"

string toarray string Return all characters in string as array elements

Input: string
Output: array
Version: 1.0
example:
_x = call loadFile format[{:string toarray "%1"}, "hello"]
Value of _x would be ["h", "e", "l", "l", "o"]

Changelog:
v1.1 - quotations marks are replaced with apostrophes to avoid errors
v1.11 - modified fix from previous version - quotes are returned normally

file exists name Return 1 if file fwatch/mdb/name exists, -1 if not.

Input: string
Output: integer
Version: 1.0
example:
_x = call loadFile ":file exists test.db"
Value of _x is 1 if file fwatch/mdb/test.db exists, -1 if it doesn't

file write name var val Write var=val to file fwatch/mdb/name
Return value: -1 if failed, 1 if succeeded

Input: 1:string file   2:string var   3:any value
Output: integer
Version: 1.0
example:
call loadFile format[":file write test.db %1 %2", "foo", 1]
File fwatch/mdb/test.db would contain foo=1

Changelog:
v1.1 - value is not transformed to lowercase
v1.11 - variable name can have '=' character

file qwrite name var val Write var=val to file fwatch/mdb/name, without checking if value already exists in file
Return value: -1 if failed, 1 if succeeded

Input: 1:string file   2:string var   3:any value
Output: integer
Version: 1.0
example:
call loadFile format[":file qwrite test.db %1 %2", "foo", 1]
File fwatch/mdb/test.db would contain foo=1

Unlike file write, file qwrite does not check if the value being written already exists in the file. This is much faster, especially when writing to large files, but without the check you can write the same value into the file multiple times which can lead into unexpected behaviour when reading values.

file awrite name var val Appends val to var in file fwatch/mdb/name
Return value: -1 if failed, 1 if succeeded

Input: 1:string file   2:string var   3:array value
Output: integer
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=[1,2])
call loadFile format[":file awrite test.db %1 %2", "foo", [3,4]]
File fwatch/mdb/test.db would contain foo=[1,2,3,4]
This function can be used to overcome the 132 character limit in OFP filenames to write values longer than that to files. It should only be used to write string or array values, make sure the value you are adding is of the same type as the the value already in the file.

All the file handling functions in fwatch have a limit of 2048 characters per line, if the resulting line in the file would be longer than this the function will fail and return -1. If a value for var is not already in the file it will not be added.

Changelog:
v1.1 - if var doesn't exist then it's created; fixed error when appending empty array or to empty array; fixed missing new line after writing data
v1.11 - variable name can have '=' character

file read name var Read value of var from file fwatch/mdb/name

Input: 1:string file   2:string var
Output: any
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=1)
_x = call loadFile format[":file read test.db %1", "foo"]
Value of _x would be 1

Changelog:
v1.1 - value is not transformed to lowercase
v1.11 - variable name can have '=' character

file vars name Return array of all vars in file fwatch/mdb/name

Input: string file
Output: array
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=1 and test="hello")
_x = call loadFile format[":file vars test.db"]
Value of _x would become ["foo", "test"]

Changelog:
v1.11 - variable name can have '=' character

file readvars name Read all vars and values from file fwatch/mdb/name
Return value: -1 if failed, 1 if succeeded

Input: string file
Output: any
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=1 and test="hello")
call loadFile format[":file readvars test.db"]
Value of foo would become 1, and value of test would become "hello".

When reading local variables they need to be initialized first in the upper scope, ie:
(File fwatch/mdb/test.db contains _foo=1)
_foo=0
call loadFile format[":file readvars test.db"]

file remove name var Remove a val from file fwatch/mdb/name
Return value: -1 if failed, 1 if succeeded

Input: 1:string file   2:string var
Output: any
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=1 and test="hello")
call loadFile format[":file remove test.db foo"]
foo would be removed from fwatch/mdb/test.db

Changelog:
v1.11 - variable name can have '=' character

file delete name Remove file fwatch/mdb/name
Return value: -1 if failed, 1 if succeeded

Input: 1:string file   2:string var
Output: any
Version: 1.0
example:
(File fwatch/mdb/test.db contains foo=1 and test="hello")
call loadFile format[":file delete test.db"]		
File fwatch/mdb/test.db would be deleted entirely

file wget url Get http URL
Return value: -1 if failed, 1 if succeeded

Input: string address
Output: any
Version: 1.0
example:
[] exec ":file wget http://www.site.domain/something.sqs"	
You must wait at least one second between calls to file wget, or the function returns -1

input getkeys Return array of all keyboard keys pressed

Input: (optional) string ("side")
Output: array
Version: 1.0
example:
The user has keys Shift and X down
_keys = call loadfile ":input getkeys"
Value of _keys would be ["SHIFT", "X"]

Changelog:
v1.1 - covers whole keyboard; optional argument - returns LSHIFT, RSHIFT, LCTRL, RCTRL, LALT, RALT instead of SHIFT, CTRL, ALT
v1.11 - returns MULTIPLY instead of SELECT when numpad asterisk was pressed

input getkey key Return 1 if key is down, -1 otherwise

Input: string
Output: integer
Version: 1.0
example:
_x = call loadfile ":input getkey X"
Value of _x is 1 if user has key X pressed

input agetkeys Return array of all keyboard keys pressed
Asynchronous version of input getkeys

Input: (optional) string ("side")
Output: array
Version: 1.0
example:
The user has pressed X since the last call of agetkeys
_keys = call loadfile ":input agetkeys"
Value of _keys would be ["X"]

This function does not work as expected when the user is holding down multiple keys at the same time. Therefore input getkeys should be used instead of this to get key combinations.

Changelog:
v1.1 - covers whole keyboard; optional argument - returns LSHIFT, RSHIFT, LCTRL, RCTRL, LALT, RALT instead of SHIFT, CTRL, ALT
v1.11 - returns MULTIPLY instead of SELECT when numpad asterisk was pressed

input agetkey key Return 1 if key is down, -1 otherwise
Asynchronous version of input getkey

Input: string
Output: integer
Version: 1.0
example:
_x = call loadfile ":input agetkey X"
Value of _x is 1 if user has pressed X since the last call to this function or input agetkeys

input getmouse Return mouse state as array [xpos, ypos, left button, right button, middle button]

Input: nothing
Output: array
Version: 1.0
example:
mouse cursor is at 543x234 and left button is pressed
_mouse = call loadfile ":input getmouse" 
Value of _mouse would be [543, 234, true, false, false]

Positions are at screen coordinates and the cursor stops moving when it reaches a screen edge. Mouse button states work asynchronously, so if you query the state every 5 seconds and the button was clicked during this time the state will be true even if the button is not down at the moment.

input setmouse x y Set mouse cursor to position x y

Input: 1:integer axis x   2:intger axis y
Output: nothing
Version: 1.0
example:
call loadfile ":input setmouse 500 300" 
Mouse cursor would be moved to coordinates 500x300

file dxdll Check if d3d8.dll file is in the game directory.

Input: Nothing
Output: Bool
Version: 1.1
example:
_dxdll = call loadFile ":file dxdll"


file list Returns list of files in the fwatch\mdb\ directory. Main array size depends on number of files (empty if nothing was found). Extra parameter should contain a wildcard (*). In case of error it returns string - error message.

Input: (optional) String filter
Output: Array: (with arrays)
0 - String file name
1 - Integer is folder (0 or 1)
2 - String file extension
Version: 1.11
example:
_files = call loadFile ":file list"


file modlist Returns list of folders with names starting with '@' (common modfolder naming convention) in the game directory. Main array size depends on number of files (empty if nothing was found). In case of error it returns string - error message.

Input: Nothing
Output: Array: (with arrays)
0 - String file name
1 - Integer is folder (0 or 1)
2 - String file extension
Version: 1.11
example:
_mods = call loadFile ":file modlist"


file read2 It works similar to :file read with the difference that the source folder is not /fwatch/mdb/ but the game root directory. In case of error it returns -1.

Input: 1: String file   2: String variable name
Output: Any
Version: 1.1
example:
_var = call loadFile ":file read2 flashpoint.cfg language"


file renamemissions Renames MPMissions directory to name1 and name2 directory to MPMissions. Result number is zero on success. Do not pack mission (PBO) which uses this command, otherwise it won't work.

Input: String name1   String name2
Output: Array:
0 - Integer operation1 result
1 - Integer operation2 result
Version: 1.11
example:
loadFile ":file renamemissions MPMissions@bis MPMissions@fdf"


i Command dedicated for the IGSE script. Saves given text to a file pointed by the :ip. It's not required to pass string inside a quote. Input text mustn't exceed 124 characters. Default source is Users\<name>\(MP)missions\. Optional parameter changes path to In-Game-Script-Editor\ directory. Passed \t are replaced with tabulators. Passing =newline=, =copyline=, =deleteline=, =clearline= will modify the file accordingly.

Input: 1: String text   2: (optional) String IGSE folder ("\c")
Output: Bool operation status
Version: 1.1
example:
_success = call loadFile ":i Hello World!"

Changelog:
v1.11
- fixed issue with writing in empty files

il Command dedicated for the IGSE script. Returns list of files in the current mission directory (Users\<name>\(MP)missions\). Main array size depends on number of files (empty if nothing was found). Extra parameter should contain a wildcard (*). It's not required to pass string inside a quote. Input text mustn't exceed 123 characters. In case of error it returns string - error message.

Input: (optional) String additional path
Output: Array: (with arrays)
0 - String file name
1 - Integer is folder (0 or 1)
2 - String file extension
Version: 1.1
example:
_files = call loadFile ":il"

Changelog:
v1.11
- array does not contain '.' and '..'
- in case of error it returns string instead of array with error code
- returns empty array if no files were found

in Command dedicated for the IGSE script. Opens selected file from the current mission directory (Users\<name>\(MP)missions\) with given access mode (default is "a"):
  • "a" - creates new file if it doesn't exist (default)
  • "w" - creates new file if it doesn't exists; otherwise erase existing content
  • "r" - to check if file exists
Input text mustn't exceed 121 characters (in case of one param).

Input: 1: String file name   2: (optional) String access mode
Output: Bool operation status
Version: 1.11
example:
_success = call loadFile Format [{:in "%1"}, "new.txt"]


info date Get current date, time and time zone information from Windows.
Time zone variable is the difference from GMT in minutes. It does not represent current time but Windows time zone setting.

Input: Nothing
Output: Array:
0 - Integer year
1 - Integer month
2 - Integer day
3 - Integer day name (0 to 6)
4 - Integer hour
5 - Integer minutes
6 - Integer seconds
7 - Integer milliseconds
8 - Integer time zone
Version: 1.1
example:
_date = call loadFile ":info date"


input getjoystick Reads joystick input using Windows API. In case of error it returns empty array. More information you'll find in this section.

Input: (optional) Integer - joystick ID.
Output: Array:
0 - Array (strings) axes names (X, Y, Z, R, U, V)
1 - Array (integers) axes values (from 0 to 65535)
2 - Array (integers) buttons (1 - pressed,
0 - not)
3 - Array (mixed) POV

0 - String type (nopov, digital, analog)
1 - Integer value (from 0 to 65535) 4 - Array (integers) ID numbers (assigned system ID, manufacturer, product)
Version: 1.1
example:
_joystick = call loadFile ":input getjoystick"


input lock Command returns state (on / off) of the numeric keypad lock, capital letters lock and scrolling lock.

Input: Nothing
Output: Array
0 - Bool Num Lock
1 - Bool Caps Lock
2 - Bool Scroll Lock
Version: 1.1
example:
_lock = call loadFile ":input lock"


io Command dedicated for the IGSE script. Returns a single line from the selected text file in the current mission directory (Users\<name>\(MP)missions\). Optional parameter changes path to In-Game-Script-Editor\ directory. Returns =ERROR= if couldn't open file and =EOF= if failed to read the line. Total length of the arguments mustn't exceed 120 characters (in case of two params).

Input: 1: String file name   2: Integer line number   3: (optional) String IGSE folder
Output: String
Version: 1.1
example:
_line = loadFile Format [{:io "%1" %2}, "init.sqs", 1]

Changelog:
v1.11
- returns =ERROR= instead of ERROR and =EOF= instead of EOF

ip Command dedicated for the IGSE script. Saves given data to a pointer file which is used by :i. Total length of the arguments mustn't exceed 120 characters.

Input: 1: String file name   2: Integer line number
Output: Nothing
Version: 1.1
example:
loadFile format [{:ip "%1" %2}, "init.sqs", 1]


ir Command dedicated for the IGSE script. Changes file name (pointed by :ir) from the current mission directory (Users\<name>\(MP)missions\) to the given text (passed in :IR). It's not required to pass string inside a quote. Input text mustn't exceed 123 characters.

Input: String file name
Output: Bool operation status
Version: 1.11
example:
_success1 = call loadFile ":ir old.txt"
_success2 = call loadFile ":IR new.txt"


mem getcam Reads camera values from the memory.

Input: Nothing
Output: Array:
0 - Float X-axis coordinate
1 - Float Y-axis coordinate
2 - Float z-axis coordinate
3 - Float direction
4 - Float pitch
5 - Float field of view
Version: 1.11
example:
_camera = call loadFile ":mem getcam"


mem getcinemaborder Reads value from the memory indicating whether cutscene borders are enabled.

Input: Nothing
Output: Bool
Version: 1.11
example:
_border = call loadFile ":mem getcinemaborder"


mem getcursor Reads dialog cursor position from the memory. X:50 Y:50 is the center of the screen.

Input: Nothing
Output: Array:
0 - Float X-axis coordinate
1 - Float Y-axis coordinate
Version: 1.1
example:
_cursor = call loadFile ":mem getcursor"


mem getdate Reads game world date from the memory. Values are not updated until the watch is shown.

Input: Nothing
Output: Array:
0 - Integer year
1 - Integer month
2 - Integer day
3 - Integer day name (0 to 6)
4 - Integer day of the year (0 to 364)
Version: 1.11
example:
_date = call loadFile ":mem getdate"


mem getdaylight Reads values from memory regarding current amount of light. First value reaches peak at noon and goes to zero when it's fully dark. Second value is the general amount of brightness - it's month dependant. Vehicle lights are enabled around [0.33, 0.05].

Input: Nothing
Output: Array:
0 - Float time of day (0 to 0.75)
1 - Float brightness (0.05 to 1)
Version: 1.11
example:
_light = call loadFile ":mem getdaylight"


mem getgraphics Reads player's graphics settings from the memory. Refresh rate equals zero in windowed mode.

Input: Nothing
Output: Array:
0 - Integer resolution X
1 - Integer resolution Y
2 - Integer refresh rate
3 - Integer multitexturing (0 or 1)
4 - Integer object shadows (0 or 1)
5 - Integer vehicle shadows (0 or 1)
6 - Integer cloudlets (0 or 1)
7 - Integer blood (0 or 1)
8 - Float brightness (0.4 to 1.8)
9 - Float gamma correction (0.5 to 2.3)
10 - Float framerate (10 to 30)
11 - Float visual quality (0.05 to 0.5)
12 - Float visibility (500 to 5000)
13 - Float terrain detail (3.125, 6.25, 12.5, 25, 50)
Version: 1.1
example:
_graphics = call loadFile ":mem getgraphics"

Changelog:
v1.11
- Visual Quality is now supported
- fixed Multitexturing value

mem getjoystick Reads joystick input from the memory. More information you'll find in this section.

Input: Nothing
Output: Array:
0 - Float axis X (from -1 to 1)
1 - Float axis Y (from -1 to 1)
2 - Float rudder (from -1 to 1)
3 - Float thrust (from -1 to 1)
4 - Integer Button #1 (0 or 1)
5 - Integer Button #2 (0 or 1)
6 - Integer Button #3 (0 or 1)
7 - Integer Button #4 (0 or 1)
8 - Integer Button #5 (0 or 1)
9 - Integer Button #6 (0 or 1)
10 - Integer Button #7 (0 or 1)
11 - Integer Button #8 (0 or 1)
12 - String POV Vertical ("", "UP", "DOWN")
13 - String POV Horizontal ("", "LEFT", "RIGHT")
Version: 1.1
example:
_joystick = call loadFile ":mem getjoystick"


mem getmap Reads value from the memory indicating whether island map is displayed.

Input: Nothing
Output: Bool
Version: 1.1
example:
_map = call loadFile ":mem getmap"


mem getnv Reads value from the memory indicating whether player is using nightvision goggles.

Input: Nothing
Output: Bool
Version: 1.11
example:
_isNV = call loadFile ":mem getnv"


mem getoptics Reads values from the memory indicating if player is using weapon sights. They may be toggled but not shown (e.g. weapon doesn't have optics or current animation does not allow to).

Input: Nothing
Output: Array:
0 - Bool toggle
1 - Bool display
Version: 1.1
example:
_optics = call loadFile ":mem getoptics"


mem getplayeranim Read player's soldier current animation code from the memory. More information you'll find in this section.

Input: (optional) String debug mode ("debug")
Output: Integer OR if debug Array (with integers)
Version: 1.1
example:
_anim = call loadFile ":mem getplayeranim"


mem getplayerview Reads player's camera mode value from the memory.

Input: Nothing
Output: String view ("internal", "gunner", "external", "group")
Version: 1.11
example:
_view = loadFile ":mem getplayerview"


mem getrespawntype Reads value from the memory indicating player's respawn mode in a multiplayer mission. Details you'll find here.

Input: Nothing
Output: Integer type (0 to 4)
Version: 1.11
example:
_respawn = call loadFile ":mem getrespawntype"


mem getresside Reads value from the memory indicating to whom resistance units are friendly.

Input: Nothing
Output: String side ("west", "east", "everybody", "nobody")
Version: 1.11
example:
_resistance =  loadFile ":mem getresside"


mem getscroll Reads mouse scroll counter from the memory. It increases by 1 every time user rolls wheel forward and decreases when rolls backward.

Input: Nothing
Output: Integer
Version: 1.1
example:
_scroll = call loadFile ":mem getscroll"

Changelog:
v1.11
- now should work on every machine

mem getworld Reads island shortcut name from the memory.

Input: Nothing
Output: String
Version: 1.1
example:
_island = loadFile ":mem getworld"

Changelog:
v1.11
- dedicated server compatibility

mem setbrightness Changes brightness and gamma by modifying values in the memory. If parameter equals zero - value won't be modified.

Input: 1: Float brightness   2: Float gamma correction
Output: Nothing
Version: 1.1
example:
loadFile ":mem setbrightness 3 0"


mem setcloudlets Changes cloudlets (graphical) setting in the memory.

Input: Integer (0 or 1) OR Bool
Output: Nothing
Version: 1.11
example:
loadFile ":mem setcloudlets 1"


mem setcursor Sets dialog cursor position by writing values to the memory.

Input: 1: Float - X-axis coordinate   2: Float - Y-axis coordinate
Output: Nothing
Version: 1.1
example:
loadFile ":mem setcursor 50 50"


mem setmap Switches island map on / off by changing value in the memory. Game does not allow showing a map during a cutscene.

Input: Integer (0 or 1) OR Bool
Output: Nothing
Version: 1.1
example:
loadFile ":mem setmap 1"


mem setoptics Changes optics toggle value in the memory.

Input: Integer (0 or 1) OR Bool
Output: Nothing
Version: 1.1
example:
loadFile ":mem setoptics 1"


mem setplayeranim Changes player's unit current animation by modifying value in the memory. More information you'll find in this section.

Input: Integer animation code
Output: Nothing
Version: 1.1
example:
loadFile ":mem setplayeranim 101"


mem setplayerview Changes player's camera mode by modifying value in the memory. Works similarly to switchCamera.

Input: String view ("internal", "gunner", "external", "group")
Output: Nothing
Version: 1.11
example:
loadFile ":mem setplayerview internal"


mem setrespawntype Changes player's respawn mode by modifying value in the memory.

Input: Integer type (from 0 to 4)
Output: Nothing
Version: 1.11
example:
loadFile ":mem setrespawntype 0"


mem setviewdistance Changes game visibility range by modifying value in the memory. It lasts until mission termination or if user enters video settings menu.

Input: Float meters
Output: Nothing
Version: 1.1
example:
loadFile ":mem setviewdistance 500"


mem setvquality Temporarily changes visual quality (graphical) setting in the memory.

Input: Float
Output: Nothing
Version: 1.11
example:
loadFile ":mem setvquality 0.005"


restart client Launches third party program which terminates current game process and then crates a new one with given arguments. Parameters previously passed to the game are transferred to the new instance (except -mod and -connect). Total length of the arguments should not exceed 105 characters. Operations are documented in a log file in fwatch\data\ directory.

Input: (optional) String arguments
Output: Nothing
Version: 1.11
example:
call loadFile ":restart client"


restart server Terminates current server process and then crates a new one with given arguments. Executable (OFPR_Server.exe, ColdWarAssault_Server.exe) must be in the game directory. Command should be executed only on the server side. Total length of the arguments should not exceed 111 characters.

Input: (optional) String arguments
Output: Nothing
Version: 1.11
example:
loadFile ":restart server"


s Identical to :string length. It's not required to pass string inside a quote. Input text mustn't exceed 124 characters.

Input: String text
Output: Integer
Version: 1.1
example:
_length = call loadFile format [":s %1", "foo bar"]


sc Compares two strings with each other according to the lexicographical order. Case insensitive. Use :sC for case sensitive check. Total length of the arguments mustn't exceed 118 characters.

Input: 1: String text1   2: String text2
Output: Integer
0 - text1 and text2 are identical
1 - text1 is greater than text2
-1 - text1 is less than text2
Version: 1.1
example:
_value = call loadFile format [{:sc "%1" "%2"}, "Hello", "World!"]

Changelog:
v1.11
- added case sensitivity variant
- case insensitive by default

se Determines if string consists entirely out of whitespace (e.g. spaces, tabs). It's not required to pass string inside a quote. Input text mustn't exceed 123 characters.

Input: String text
Output: Bool
Version: 1.11
example:
_isEmpty = call loadFile format [":se %1", " "]


sf Similar to :string length. Case insensitive. If additional argument was passed then given number of characters from the beginning will be skipped. If text was not found it returns -1. Total length of the arguments mustn't exceed 118 characters (in case of two params).

Input: 1: String occurrence   2: String text   3: (optional) Integer position to search from
Output: Integer position
Version: 1.11
example:
_index = call loadFile format[{:sf "%1" "%2"}, "FOO", "xx foo yy Foo"]


spig exe Command dedicated for the SPIG script. Executes given program from the Set-Pos-In-Game\Exe\ directory. Second argument is a file to be processed from fwatch\mdb\ folder. In case of error it returns string - error message.

Input: 1: String executable name   2: String file name  
Output: Array:
0 - Integer result code
Version: 1.11
example:
loadFile ":spig exe spig2sqm.exe spig_sqm1.txt"


sr This command is unreliable and not recommended to use. Replaces all occurrences in a string with given pattern. Case sensitive. Total length of the arguments mustn't exceed 115 characters.

Input: 1: String text   2: String occurrence   3: String replacement
Output: String
Version: 1.1
example:
_string = loadFile format [{:sr "%1" "%2" "%3"}, "Hello World!", "Hello", "Hi"]


st Determines if string consists out of digits. Spaces are ignored. Use :sT to omit mathematical operators. It's not required to pass string inside a quote. Input text mustn't exceed 123 characters.

Input: String text
Output: String ("string", "integer", "float")
Version: 1.1
example:
_value = loadFile format [":st %1", "50.58"]

Changelog:
v1.11
- added variant to omit math symbols
- math operators are not ignored by default
- if more than one dot or one dash - returns string
- ignores all whitespace characters
- not required to pass extra quotes
- returns string if dash is not first character (default variant)
- returns string if dot was found but there isn't any number

sv Determines if string can be used as a scripting variable name. It's not required to pass string inside a quote. Input text mustn't exceed 123 characters.

Input: String text
Output: Bool
Version: 1.11
example:
_isVar = call loadFile format [":sv %1", "_var10"]