Skip to content
Kex edited this page Jan 4, 2017 · 36 revisions

###Content:

  1. Note
  2. Register Custom Module
  3. Integrate Selection Option
  4. Dynamic Dialogs

###Note: This page is dedicated to the "Execute Code" module. This module allows you executing scripts and thus, also implementing Custom Modules.

###Register Custom Module: As in Ares you can define your own custom modules. The function to register custom modules is Ares_fnc_RegisterCustomModule.
There are two wais to use that function:

  1. You can define a custom module in the mission. As an example you can place the code below in init.sqf of your mission:

if (local player and (isClass (configFile >> "CfgPatches" >> "achilles_modules_f_achilles"))) then
{
    ["My Category", "My Module",
    {
        _module_position = param [0,[0,0,0],];
        _selected_object = param [1,ObjNull,[ObjNull]];
        systemChat format ["Module position: %1", _module_position];
        systemChat format ["Selected Object: %1", _selected_object ]
    }] call Ares_fnc_RegisterCustomModule;
};

  1. Execute Ares_fnc_RegisterCustomModule with the Execute Code module.

###Integrate Selection Option: A template to integrate the [Selection Option] is presented below:

["My Category", "My Module",
{
     private "_selected_objects";      _module_position = param [0,[0,0,0],];
     _selected_object = param [1,ObjNull,[ObjNull]];
    
    if (isNull _selected_object) then
    {
        _selected_objects = ["objects"] call Achilles_fnc_SelectUnits;
    } else
    {
        _selected_objects = [_selected_object];
    };
    if (isNil "_selected_objects") exitWith {};
    if (count _selected_objects == 0) exitWith
    {
        ["No object was selected!"] call Ares_fnc_ShowZeusMessage;
        playSound "FD_Start_F"
    };
    systemChat str [_module_position, _selected_objects];
}] call Ares_fnc_RegisterCustomModule;

As you see in the line with systemChat, there are two private variables available:

  • _module_position    ARRAY     Returns position AGLS where the module was placed.
  • _selected_object      ARRAY     Array of selected objects.

###Dynamic Dialogs: