FSXA Time of day change

Is there a simConnect notification event for when a time of the day is changed through the UI? I can't seem to find anything on it...
 

DragonflightDesign

Resource contributor
Is there a simConnect notification event for when a time of the day is changed through the UI? I can't seem to find anything on it...
Misho - this is a really late answer and is probably useless for the purpose that you need it, but, no, there isn't a notification through SimConnect. What I've done is to track the TICK18 timer and if it exceeds the check flag by more than one tick, I assumed either a menu change or a drag event.
Code:
    static double prev_tick = -1;
    // Seed the check flag
    if (prev_tick == -1)prev_tick = getTick();
    // Trap a time change by menu. Video processing is suspended while the menu is active or a drag event is in progress
    if (prev_tick != getTick())
    {
        // Either drag event or a menu time change event has occurred
        if (getTick() > prev_tick + 1)
       {
          // Do something here
       }
        prev_tick = getTick();
    }
I'd guess you could dump something on the ClientEvent stream and read that. getTick() is just a lazy function for tick18:
Code:
double getTick()
{
    lookup_var(&currtick18);
    return currtick18.var_value.n;
}
This post is more for someone who may be looking for an answer to a similar question.
 
Hi, thanks for responding. Yeah - after a bit of research and trial and error, I did manage to "crack" this. I'm posting the solution here, hoping it just might help someone.

Here's what happens: the change of time event actually triggers "FlightSaved" system event, which saves the flight into a temporary file, but with "new" time/date. This temporary file has a special, hard coded name:

"Program generated temporary flight.FLT"

The flight is then reloaded with this temporary FLT file, and a new date/time is applied.

So, all you need to check for is if the event parameter contains this particular file name - which means the TOD has been changed. Here's the code:


Code:
                case EVENT_FLIGHTSAVED: // this is a system/server event
                    SystemVars->bChangingTOD_Pos = FALSE;
                    {
                        string strFileName = evt->szFileName;
                        if ((strFileName.find("Program generated temporary flight.FLT") != std::string::npos))
                            SystemVars->bChangingTOD_Pos = TRUE;
                    }
                    break;
In fact, the same is valid for when a user changes the aircraft position through the map. I would venture a guess that this is true for any other event that forces a reload of the sim (and I can't think of any at the moment but I am sure there are some). So, when deciding what was changed, all someone would have to do is to save all the parameters in question before the action (time of day, position, ...) and compare them with the new ones to determine what was changed.
 
Top