Hello, it would be very helpful to have a LVAR variable to be able to turn
live weather on or off. I would love to assign a physical switch (home cockpit
user) to turn live weather on or off (without using the screen
Thanks Okan Sacli
Hello, it would be very helpful to have a LVAR variable to be able to turn
live weather on or off. I would love to assign a physical switch (home cockpit
user) to turn live weather on or off (without using the screen
Thanks Okan Sacli
Yeah at the very least I would like to know if its on or off.
Rob Murdoch
PMDG
Weāre really not setting the bar very high hereā¦ Iād like an API where I can retrieve the current loaded weather data plus a ālive weatherā flag. The parameters for the weather are pretty basic (wind layers, cloud layers, temp/pressure) so reading that in a single query should be relatively simple.
Knowing whether live weather is on or off would be very useful for avionics developers, as then we can know whether to apply cold weather altimetry corrections based on temperature as some real systems do, or not. Applying corrections with offline weather would be counter-productive, as it does not seem to actually alter the lapse rate with temperature.
const wx_listener = RegisterViewListener("JS_LISTENER_WEATHER", () => {});
wx_listener.on('UpdatePreset', (weather) => {
const is_live = weather.index == 0;
console.log(weather, is_live);
// You're welcome!
});
wx_listener.on('SetWeatherList', (weather_presets) => {
// If you want the list of wx presets.
console.log(weather_presets);
});
wx_listener.trigger('ASK_WEATHER_LIST');
To noteā¦
wx_listener.unregister()
) and re-register the ViewListener if you want to get fresh data periodically. The sim doesnāt trigger UpdatePreset
when the preset changes despite what the event name infers.html_ui/js/services/weather.js
to get the full list of capabilities. Itās what the weather panel uses to control weather settings. Yes you can also inject custom weather that way To set weather to live:
wx_listener.trigger('CUSTOM_WEATHER_PRESET_CHANGED', 0); // Use the ID of the desired preset. 0 = Live
Keven Menard
//42
Keven this is awesome - massively appreciated. I looked at weather.js as soon as I discovered it but on my own I totally failed to get it to give me the ācurrent preset infoā. Your code worked straight out of the box.
For multiplayer gliding in MSFS the ability to signature the loaded weather is really quite important, so thanks again.
Hi Keven !
I really donāt know anything about code, but, although I have live weather on, the Sun desperately shines everywhere ! (Iām playing on PC) Could your code line help me ? But what should I do with it ?
Thanx for your help !