Difference between revisions of "DCS server gameGUI"
|Line 22:||Line 22:|
== Network API ==
== Network API ==
Revision as of 22:56, 17 September 2021
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:
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, makeScreenShot
Some network functions are also available in the mission scripting enviroment. See DCS_singleton_net for details. 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
The export lua environment is available here, however all functions called are prefaced with Export. For example Export.functionName