Skip to content
Marco Silipo edited this page Jan 29, 2019 · 1 revision

Theoretically, you just download the executable and would be done with it, as a simple double click is enough to fire it up. But as people enjoy doing stuff automated (or loading whole addons like CBA), this will not be enough for everybody.

In this page, you may learn how to actually load stuff like CBA into the VM and more.

Table of Contents

Example script to load methods from CfgFunctions

    private _cfgFunctions = configFile >> "CfgFunctions";
    private _preStart = [];
    private _preInit = [];
    private _postInit = [];
    for "_i" from 0 to count _cfgFunctions do
    {
        private _tagCfg = _cfgFunctions select _i;
        private _tag = configName _tagCfg;
        for "_j" from 0 to count _tagCfg do
        {
            private _subCfg = _tagCfg select _j;
            for "_k" from 0 to count _subCfg do
            {
                private _cfg = _subCfg select _k;
                private _name = configName _cfg;
                private _path = getText (_cfg >> "file");
                private _content = preprocessFile _path;
                private _code = compile _content;
                missionNamespace setVariable [
                    format ["%1_fnc_%2", _tag, _name],
                    _code
                ];
                if (getNumber (_cfg >> "PreStart") > 0) then {
                    _preStart pushBack _code;
                };
                if (getNumber (_cfg >> "PreInit") > 0) then {
                    _preInit pushBack _code;
                };
                if (getNumber (_cfg >> "PostInit") > 0) then {
                    _postInit pushBack _code;
                };
            };
        };
    };
    { "PreStart" call _x; } forEach _preStart;
    { "PreInit" call _x; } forEach _preInit;
    { "PostInit" call _x; } forEach _postInit;

Loading addons

  1. Download a release of the VM
  2. Either download the addon you want to include from their sources or extract the contents from the PBO and debinarize it.
  3. Create a new folder
  4. Put the VM release in there
  5. Put the addon in there
  6. Use `--load ` to allow the addon in file commands & `#include`. Example:
    --load ".\@CBA\Addons\hashes"
  7. Only if the addon has a namespace set using eg. $PBO_PREFIX$ use `--virtual ` to map the virtual path to the actual path. Example:
    --virtual ".\@CBA\Addons\hashes|x\cba\addons\hashes"
  8. Load the actual config file using `--input-config `. Example:
    --input-config ".\@CBA\Addons\hashes\config.cpp"
  9. Load a script to load stuff from the `CfgFunctions` class using the `--input-sqf ` command. Example:
    --input-sqf ".\cfgFunctions.sqf"
Clone this wiki locally