- Messages
- 46
- Country

Hi,
I was checking this thread:
www.fsdeveloper.com
And subscribed to the events of Sim, SimStart and SimStop, but unfortunantly, it seems that always when moving into and out of a flight, it fired stop, start, stop, start.
Firing multiple and incorrect event is ugly enough, but if it ends in a state I can't tell what happens isn't good at all!
has anyone found a reliable way of detecting whether the client is in an active flight (i.e not in the main menu)?
For example, this is the output of exiting a flight:
FSTRaK.exe Information: 0 : 2023-05-04 21:10:42.312 +03:00 [Information] Closest Airport: KDEN Distance: 927.120603887454 meters, there are 9585 airports
2023-05-04 21:10:42.703 +03:00 [Debug] === Sim Stop
2023-05-04 21:10:42.703 +03:00 [Debug] === Sim 0
2023-05-04 21:10:43.929 +03:00 [Debug] === Sim Start
2023-05-04 21:10:43.929 +03:00 [Debug] === Sim 1
2023-05-04 21:10:44.746 +03:00 [Debug] Just Flight 146-100 Air France Express
2023-05-04 21:10:44.747 +03:00 [Debug] My coords: 39.8533362352615 : -104.673097109696
FSTRaK.exe Information: 0 : 2023-05-04 21:10:44.747 +03:00 [Information] Closest Airport: KDEN Distance: 927.120603887454 meters, there are 9720 airports
2023-05-04 21:10:45.706 +03:00 [Debug] === Sim Stop
2023-05-04 21:10:45.707 +03:00 [Debug] === Sim 0
2023-05-04 21:10:58.387 +03:00 [Debug] === Sim Start
2023-05-04 21:10:58.387 +03:00 [Debug] === Sim 1
Generated by this code:
private void simconnect_OnRecvEvent(SimConnect sender, SIMCONNECT_RECV_EVENT data)
{
switch (data.uEventID)
{
case (int)EVENTS.CRASHED:
Log.Debug("=== crashed");
break;
case (int)EVENTS.SIM_START:
Log.Debug("=== Sim Start");
break;
case (int)EVENTS.SIM_STOP:
Log.Debug("=== Sim Stop");
break;
case (int)EVENTS.SIM:
Log.Debug($"=== Sim {data.dwData.ToString()}");
break;
}
}
I was checking this thread:
With simconnect detect when I'm not in flight
Hi, actually I've made my interface that get informations from the game all time like (acceleration, speed , plane name ...). Even in the menu the data are updated. I initialize my listener like this my_simconnect.OnRecvOpen += new SimConnect.RecvOpenEventHandler(simconnect_OnRecvOpen)...
www.fsdeveloper.com
And subscribed to the events of Sim, SimStart and SimStop, but unfortunantly, it seems that always when moving into and out of a flight, it fired stop, start, stop, start.
Firing multiple and incorrect event is ugly enough, but if it ends in a state I can't tell what happens isn't good at all!
has anyone found a reliable way of detecting whether the client is in an active flight (i.e not in the main menu)?
For example, this is the output of exiting a flight:
FSTRaK.exe Information: 0 : 2023-05-04 21:10:42.312 +03:00 [Information] Closest Airport: KDEN Distance: 927.120603887454 meters, there are 9585 airports
2023-05-04 21:10:42.703 +03:00 [Debug] === Sim Stop
2023-05-04 21:10:42.703 +03:00 [Debug] === Sim 0
2023-05-04 21:10:43.929 +03:00 [Debug] === Sim Start
2023-05-04 21:10:43.929 +03:00 [Debug] === Sim 1
2023-05-04 21:10:44.746 +03:00 [Debug] Just Flight 146-100 Air France Express
2023-05-04 21:10:44.747 +03:00 [Debug] My coords: 39.8533362352615 : -104.673097109696
FSTRaK.exe Information: 0 : 2023-05-04 21:10:44.747 +03:00 [Information] Closest Airport: KDEN Distance: 927.120603887454 meters, there are 9720 airports
2023-05-04 21:10:45.706 +03:00 [Debug] === Sim Stop
2023-05-04 21:10:45.707 +03:00 [Debug] === Sim 0
2023-05-04 21:10:58.387 +03:00 [Debug] === Sim Start
2023-05-04 21:10:58.387 +03:00 [Debug] === Sim 1
Generated by this code:
private void simconnect_OnRecvEvent(SimConnect sender, SIMCONNECT_RECV_EVENT data)
{
switch (data.uEventID)
{
case (int)EVENTS.CRASHED:
Log.Debug("=== crashed");
break;
case (int)EVENTS.SIM_START:
Log.Debug("=== Sim Start");
break;
case (int)EVENTS.SIM_STOP:
Log.Debug("=== Sim Stop");
break;
case (int)EVENTS.SIM:
Log.Debug($"=== Sim {data.dwData.ToString()}");
break;
}
}
