ArmaDragonflyClient - Getting Started

Getting Started

Read through Getting Started Guide from DragonflyDB to get DragonflyDB up and running on your machine or use the provided binaries within the dragonfly folder.

DragonflyDB

Prerequisites

  • You must be running a Linux-based OS (if using Mac, run using Docker, Windows WSL will work as well).
  • Network access
  • Minimum 4GB of RAM to get the benifits of Dragonfly
  • Minimum 1CPU Core
  • Linux Kernel 4.19 or higher

ArmaDragonflyClient

OS Compatibility

ArmaDragonflyClient is currently only compatible with Windows. Linux is planned for a future release.

Usage

  1. Download the latest release from the Releases page.
  2. Extract the zip file to your Arma 3 directory.
  3. Create the init.sqf file in your mission folder and add the following code:
addMissionEventHandler ["ExtensionCallback", {
    params ["_name", "_function", "_data"];
    diag_log _this;
    if (_name isEqualTo "ArmaDragonflyClient") then {
        parseSimpleArray _data call (missionNamespace getVariable [_function, {
            hint "Function does not exist!"
        }]);
    };
}];
  1. Create the initServer.sqf file in your mission folder and add the following code:
if (isServer || isDedicated) then {
    true spawn dragonfly_db_fnc_init;
};
  1. Implement data persistence using ArmaDragonflyClient:
    • To enable saving and loading data from ArmaDragonflyClient, you need to create the necessary functions.
    • Refer to the Add Task wiki page for detailed information on how to create tasks in ArmaDragonflyClient.
    • Utilize the dragonfly_db_fnc_addTask function to add tasks to the ArmaDragonflyClient queue for saving and loading data.
    • Here's an example of how you can create a task to save data:

      IMPORTANT: All data must be encapsulated by brackets []

      ["hsetid", getPlayerUID player, "loadout", -1, [getUnitLoadout player]] call dragonfly_db_fnc_addTask;
      

      This example adds a task to set the value of the field "loadout" in the hash player UID to the player's loadout.
    • To load data, you can create a task using the appropriate task type, such as "hgetall" or "hget":
      ["hgetid", getPlayerUID player, "loadout", -1, [], "myCallbackFunction", false, netId player] call dragonfly_db_fnc_addTask;
      

      This example adds a task to retrieve all values from the hash player UID and pass the retrieved data to the "myCallbackFunction" for further processing.
    • Ensure that you provide the correct task type, key names, field names, and callback functions based on your specific data requirements. Please refer to the Task Types section below for more information on available task types and their corresponding data types.
    • Properly handle the retrieved data in the callback functions to utilize it effectively in your project.
      • I.e. implement public variables and waitUntil checks before proceeding onto the next task(s).
      // First Script or Function to execute `dragonfly_db_fnc_addTask`
      value_ExampleDone = false;
      publicVariable "value_ExampleDone";
      ...
      
      // Callback function to process the retrieved data
      ...
      value_ExampleDone = true;
      publicVariable "value_ExampleDone";
      
      // Next Script or Function to execute `dragonfly_db_fnc_addTask`
      waitUntil { value_ExampleDone };
      ...
      

By following these steps and leveraging the dragonfly_db_fnc_addTask function, you can implement robust data persistence functionality using ArmaDragonflyClient in your Arma 3 project.

Task Types

Task TypeData Type
getGet Data Type
setSet Data Type
delDelete Data Type
hgetHash Get Data Type
hgetidHash Get by ID Data Type
hgetallHash Get All Data Type
hgetallidHash Get All by ID Data Type
hsetHash Set Data Type
hsetbulkHash Set Bulk Data Type
hsetidHash Set by ID Data Type
hsetidbulkHash Set Bulk by ID Data Type
listaddList Add Data Type
listidxList Index Data Type
listrngList Range Data Type
listremList Remove Data Type
listsetList Set Data Type