The function library adds a range of additional functions for use in scripts. These are not scripting commands, but rather sub-routines created with existing script commands (VBS Function Library).

The VBS function library supercedes the old VBS1 Functions, although it is possible to re-load those functions for backwards compatibility with VBS1 scripts (see the VBS1 Functions article for more info).

In some limited builds of VBS (such as VBS2 Lite) some scripting functions may not be available. A popup error appears when using a function that is not available.

The following code shows a typical call syntax:

_returnvalue = [parameters] call functionName;

Note: A testing method, to check for the presence of a function, is documented in Check Function Availability.

See also: Commands A-Z


Before V3.4

  • The function library can only be utilized in SQF scripts (a script that is loaded using preprocessFile or execVM).
    Note: It cannot be used in init lines, triggers, waypoints, the Debug Console, or SQS scripts.
  • The following line must be added to the top of every script in which a call to a library function is performed:
    #include "\vbs2\headers\function_library.hpp"
  • Function names are case-sensitive.
    Incorrect use of cases results in no value being returned, and no errors being displayed (for example, fn_vbs_relPos works, while fn_vbs_RelPos does not)

Since V3.4

  • Functions can be called from any location that script commands can be executed from (init lines, triggers, waypoints, the Debug Console, or SQS scripts).
  • No #include call is needed.
  • Function names are not case-sensitive.