Thursday, June 04, 2026 5:19:39 AM
> project show esm_alpha
The experimental first version of ESM that connected Arma 3 Exile servers to a PHP website. This college project prototype established the core concepts that would evolve into the ESM ecosystem.
Details
> postInit.sqf
/*
	Bryan
	Exile Server Manager
	PostINIT, fires on... Postinit....
	Calculates the initialize params to send to the server, initializes the DLL, and creates a thread to loop request checks based on settings.
*/


_restart = getArray(configFile >> "CfgSettings" >> "RCON" >> "restartTimer");

// Data to be sent to the server
_data =
[
	getText(configFile >> "CfgESM" >> "key"),
	serverName,
	getText(configFile >> "CfgESM" >> "website"),
	getNumber(missionConfigFile >> "CfgTerritories" >> "popTabAmountPerObject"),
	getNumber(configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "territoryLifeTime"),
	_restart select 0,
	_restart select 1
];

// Get all the prices and send them as a flat string
{
	_data pushBack (_x select 0);
	_data pushBack (_x select 1);
	_data pushBack (_x select 2);
}
forEach (getArray(missionConfigFile >> "CfgTerritories" >> "prices"));

// Send the request and return
_return = parseSimpleArray(["initialize", _data] call ExileServerManager_util_dll_call);

// Make sure we actually initalized
if (_return select 0) then
{
	ESM_Initialized = true;
	ESM_ThreadDelay = getNumber(configFile >> "CfgESM" >> "requestCheckTime");
	ESM_DebugEnabled = getNumber(configFile >> "CfgESM" >> "debugEnabled") isEqualTo 1;

	// See if we want to use Exile's threading or just a stupid while loop
	if (getNumber(configFile >> "CfgESM" >> "useExileThreading") isEqualTo 1) then
	{
		[] spawn
		{
			// Since we are in postInit, there is a chance that this will fire before thread_initialize is ready.
			waitUntil {!isNil "PublicServerIsLoaded"};

			// Register it with the threading system
			[ESM_ThreadDelay, ExileServerManager_system_thread_check, [], true] call ExileServer_system_thread_addTask;
		};
	}
	else
	{
		[] spawn
		{
			waitUntil {PublicServerIsLoaded};
			while {true} do
			{
				call ExileServerManager_system_thread_check;
				uiSleep ESM_ThreadDelay;
			};
		};
	};
}
else
{
	format["Failed to initialize!!! Reason: %1", _return select 1] call ExileServerManager_util_log;
};
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2