Skip to content

Versioning System

Killswitch edited this page Jun 15, 2015 · 7 revisions

Versioning System

The versioning system allows you to register your mod, incl version. In Multiplayer, the versions are compared between server and clients, and warnings are displayed when mismatches have been detected.

Implementation

Add to your config.cpp, MyMod_main's CfgPatches section:

version = 1.0.1;
versionStr = "1.0.1";
versionAr[] = {1,0,1};

To register the mod with the CBA Versioning System:

class CfgSettings {
   class CBA {
      class Versioning {
         // This registers MyMod with the versioning system and looks for version info at CfgPatches -> MyMod_main
         class MyMod {
           // Optional: Manually specify the Main Addon for this mod
           //main_addon = "MyModAddon"; // Uncomment and specify this to manually define the Main Addon (CfgPatches entry) of the mod

           // Optional: Add a custom handler function triggered upon version mismatch
           //handler = "myMod_fnc_mismatch"; // Adds a custom script function that will be triggered on version mismatch. Make sure this function is compiled at a called preInit, not spawn/execVM

           // Optional: Dependencies
           // Example: Dependency on CBA
           /*
            class Dependencies {
               CBA[]={"cba_main", {0,8,0}, "true"};
            };
           */

           // Optional: Removed addons Upgrade registry
           // Example: myMod_addon1 was removed and it's important the user doesn't still have it loaded
           //removed[] = {"myMod_addon1"};
         };
      };
   };
};

Shared version display (optional)

Aimed at saving space on the main menu. You find this at the Main menu, right-down. It cycles between version numbers for any mods added to the system. Operation: Mouse over to temporarily pause cycling. Left click to cycle forward. Right click to cycle back. Double click to perform currently displayed mod's action, if any.

Implementation

  • versionDesc - String for Display Name. Add to the cycling display of mod names and versions on the main menu.
  • versionAct - String for Code, optional. Add a double click action using MouseButtonDblClick. Leave empty ("") or omit if not used.

Example CfgPatches entries from the A.C.E. mod:

versionDesc = "A.C.E.";
versionAct = "['MAIN',_this] execVM 'x\ace\addons\main\about.sqf';";