Well, they are not really scripts since they must be compiled.
If the code is executed out of the flight sim process, the developers can use C, C++; C# and VB.Net.
If the code is executed inside of the flight sim process, the developers can only use C++ and compile into WebAssembly format.
SimConnect C++ library is basically composed of functions without classes (procedural programming).
For example, in order to get access to a variable of the aircraft, you have to write this for example:
static enum DATA_DEFINE_ID { DEFINITION_1, DEFINITION_2 }; static enum DATA_REQUEST_ID { REQUEST_1, REQUEST_2, }; struct Struct1 { double kohlsmann; double altitude; double latitude; double longitude; }; // Match string definitions from the Simulation Variables document with the client defined ID hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Kohlsman setting hg", "inHg"); hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Indicated Altitude", "feet"); hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Plane Latitude", "degrees"); hr = SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_1, "Plane Longitude", "degrees"); // Sections of code in DispatchProc .... SimConnect_RequestDataOnSimObject(hSimConnect, REQUEST_2, DEFINITION_1, SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD_SECOND); .... // When the data is received -- cast it to the correct structure type case SIMCONNECT_RECV_ID_SIMOBJECT_DATA: { SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA*) pData; switch(pObjData->dwRequestID) { case REQUEST_2: Struct1 *pS = (Struct1*)&pObjData->dwData; // Add code to process the structure appropriately break; } break; } ....
It's a mess...
For gauges, things are a bit easier since it does not use SimConnect.
For example, to get a variable:
struct sCompassVars { NVGcontext* m_nvgctx = nullptr; ENUM m_eDegrees; ENUM m_ePlaneHeadingDegreesTrue; int m_iFont; }; sCompassVars g_CompassVars; ... g_CompassVars.m_eDegrees = get_units_enum("DEGREES"); g_CompassVars.m_ePlaneHeadingDegreesTrue = get_aircraft_var_enum("PLANE HEADING DEGREES TRUE"); FLOAT64 fHeading = aircraft_varget(g_CompassVars.m_ePlaneHeadingDegreesTrue, g_CompassVars.m_eDegrees, 0); ...
Much better. But not every gauges are written in C++.
A new way of creating gauges has been introduced in MSFS: the gauges are written in HTML, CSS and JS.
I'll try to find a way to use this approach for Open Rails.