DCS server gameGUI

From DCS World Wiki - Hoggitworld.com
Revision as of 17:01, 18 December 2018 by Acidictadpole (talk | contribs)


DCS uses a special API for use in multiplayer. Specifically it is best used as part of a game server to automate assorted administration functionality. Eagle Dynamics maintains documentation for this API in a file as part of your install. This wiki article is simply for easy of use. The original documentation can be found here:

 INSTALL/API/DCS_ControlAPI.html

Callbacks/Hooks

When loading, DCS searches for Saved Games\DCS\Scripts\Hooks\*.lua files, sorts them by name and then loads into the GUI Lua-state. Each user script is loaded into an isolated environment, so the only thing they share is the state of the simulator. You can use any lua file in this folder to execute any of the API calls below or call other scripts.

The lua is referenced by calling `DCS.setUserCallBacks(myHandler)` in your hook.

onMissionLoadBegin, onMissionLoadProgress, onMissionLoadEnd, onSimulationStart, onSimulationStop, onSimulationFrame, onSimulationPause, onSimulationResume, onGameEvent, onNetConnect, onNetMissionChanged, onNetConnect, onNetDisconnect, onPlayerConnect, onPlayerDisconnect, onPlayerStart, onPlayerStop, onPlayerChangeSlot, onPlayerTryConnect, onPlayerTrySendChat, onPlayerTryChangeSlot

DCS Control API

setPause, getPause, stopMission, exitProcess, isMultiplayer, isServer, getModelTime, getRealTime, getMissionOptions, getAvailableCoalitions, getAvailableSlots, getCurrentMission, getMissionName, getMissionFilename, getMissionResult, getUnitProperty, getUnitType, getUnitTypeAttribute, writeDebriefing, setUserCallbacks, reloadUserScripts, makeScreenShot

Network API

send_chat, send_chat_to, recv_chat, load_mission, load_next_mission, get_player_list, get_my_player_id, get_server_id, get_player_info, kick, get_stat, get_name, get_slot, set_slot, force_player_slot, lua2json, json2lua, dostring_in, log, trace

Export

The export lua environment is available here, however all functions called are prefaced with Export. For example Export.functionName