set the Season and Time of Day using C#

Discussion related to terrain/scenery design.
Locked
ppp333ddd_
Posts: 58
Joined: Fri Aug 18, 2017 1:04 am

set the Season and Time of Day using C#

Post by ppp333ddd_ »

Hi,
I am using C# WPF to read and write data in P3D V4. I need to implement the function to choose Season and Time of Day but I can't find any API from simconnect webpage or SDK regarding them. Can anyone help? Thanks.

Kind regards,
Jeff
User avatar
Rob McCarthy
Lockheed Martin
Posts: 3703
Joined: Wed Aug 24, 2011 1:37 pm

Re: set the Season and Time of Day using C#

Post by Rob McCarthy »

Sorry, we currently don't expose a way to change time/season through SimConnect or the PDK. The SimConnect_FlightLoad function can be used to load scenarios with different times and seasons.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead
ppp333ddd_
Posts: 58
Joined: Fri Aug 18, 2017 1:04 am

Re: set the Season and Time of Day using C#

Post by ppp333ddd_ »

Hi Rob,

Sorry for my late reply. I was assigned some new tasks and I will try the function you told me later. Thanks!

Kind regards,

Jeff
ppp333ddd_
Posts: 58
Joined: Fri Aug 18, 2017 1:04 am

Re: set the Season and Time of Day using C#

Post by ppp333ddd_ »

Hi Rob,

I found that an Event ID called KEY_ZULU_DAY_SET is able to set the date in P3D by simconnect, https://msdn.microsoft.com/en-us/library/cc526980.aspx
but not sure if it should be used in TransmitClientEvent, SetDataOnSimObject or any other function/API. Could you help? Thanks.

Jeff
obinder
Posts: 145
Joined: Sun Jun 08, 2014 9:43 am

Re: set the Season and Time of Day using C#

Post by obinder »

Hello Jeff,

this is really simple. The third parameter of "TransmitClientEvent" is the uint dwData. In dwData you provide the value that you want to set.

ZULU_YEAR_SET: set the year (2017)
ZULU_DAY_SET: set the day of the year (1-365)
ZULU_HOURS_SET: set the hour of day (0-24)
ZULU_MINUTES_SET: set the minutes (0-60)

Learning Center -> SDK -> References -> Variables -> Event IDs

If you make large changes to these variables the simulator will reload the scenario, and it will adjust season and time of day depiction accordingly.

Best regards
Oliver Binder
Lorby-SI
Locked