6) and string.match(word, "*[0-9][0-9]KT")) { # We've got the wind definition word. Now to split it up. # Format is nnnmmKT or nnnmmGppKT # Direction is easy - the first 3 characters. var dir = chr(word[0]) ~ chr(word[1]) ~ chr(word[2]); if (dir == "VRB") { setprop("/local-weather/tmp/tile-orientation-deg", 360.0 * rand()); setprop("/local-weather/tmp/gust-angular-variation-deg", 180.0); setprop("/local-weather/tmp/gust-frequency-hz", 0.001); } else { setprop("/local-weather/tmp/tile-orientation-deg", dir); setprop("/local-weather/tmp/gust-angular-variation-deg", 0.0); setprop("/local-weather/tmp/gust-frequency-hz", 0.0); } # Next two are the base wind var spd = chr(word[3]) ~ chr(word[4]); setprop("/local-weather/tmp/windspeed-kt", spd); var gst = 0; if ((size(word) > 7) and (chr(word[5]) == 'G')) { # Gusty case gst = chr(word[6]) ~ chr(word[7]); } if ((gst > spd) and (spd > 0)) { setprop("/local-weather/tmp/gust-relative-strength", (gst - spd) / spd); setprop("/local-weather/tmp/gust-frequency-hz", 0.7); } else { setprop("/local-weather/tmp/gust-relative-strength", 0.0); } } } if (local_weather_props != nil) { # The local weather properties need to be set now, so they can # be configured by the user if they select Advanced Settings props.copy(local_weather_props, props.globals.getNode("/local-weather/tmp", 1)); } else { # If no local weather properties have been set, we'll read from the scenario # METAR setprop("/local-weather/tmp/tile-type", "manual"); setprop("/local-weather/tmp/tile-management", "METAR"); } me.refresh(); }, metarListener : func( n ) { var metar = getprop("environment/metar/data"); if( metar == nil or metar == "" ) metar = "NIL"; metar = normalize_string(metar); printlog( "info", "new METAR: " ~ metar ); setprop( me.base ~ "/metar-string", metar ); gui.dialog_update( "weather-conditions", "metar-string" ); }, }; var controller = GlobalWeatherDialogController.new( cmdarg() ); controller.open(); ]]> weather false false vbox 3 hbox 1 true true vbox left hbox left true table 0 0 left simple-weather sim/gui/dialogs/metar/mode/global-weather true property-assign sim/gui/dialogs/metar/mode/global-weather 1 property-assign sim/gui/dialogs/metar/mode/local-weather 0 property-assign sim/gui/dialogs/metar/mode/manual-weather 0 nasal 0 2 manual-weather-config sim/gui/dialogs/metar/mode/manual-weather true sim/gui/dialogs/metar/mode/global-weather dialog-apply manual-weather-config nasal basic description fill true 250 55 0 false true true sim/gui/dialogs/metar/description[1] hbox left true table 0 0 left simple-weather sim/gui/dialogs/metar/mode/local-weather true property-assign sim/gui/dialogs/metar/mode/local-weather 1 property-assign sim/gui/dialogs/metar/mode/global-weather 0 property-assign sim/gui/dialogs/metar/mode/manual-weather 0 nasal advance-description fill true 250 55 0 false true true sim/gui/dialogs/metar/description[2] table true vbox table 0 0 0 1 source-selection fill true 400 sim/gui/dialogs/metar/source-selection sim/gui/dialogs/metar/mode/manual-weather 0 dialog-apply source-selection dialog-update metar-string hbox true /environment/metar/valid hbox metar-string fill true 250 60 true true false false sim/gui/dialogs/metar/metar-string sim/gui/dialogs/metar/mode/manual-weather 0 sim/gui/dialogs/metar/source-selection Manual input dialog-apply metar-string hbox true description fill true 250 150 0 false true true sim/gui/dialogs/metar/description[0] true hbox true