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); logprint(LOG_DEBUG, "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 hbox vbox 1 vbox left hbox left 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 1 right manual-weather-config sim/gui/dialogs/metar/mode/manual-weather true sim/gui/dialogs/metar/mode/global-weather dialog-apply manual-weather-config nasal 0 2 true basic description fill true 70 15 false true true 0 sim/gui/dialogs/metar/description[1] hbox left 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 0 1 0 2 true advance-description fill true 90 15 false true true 0 sim/gui/dialogs/metar/description[2] true vbox 1 hbox vbox 1 vbox left hbox left table 0 0 left 0 1 left 0 2 source-selection fill true 300 sim/gui/dialogs/metar/source-selection sim/gui/dialogs/metar/mode/manual-weather 0 dialog-apply source-selection dialog-update metar-string-input description fill true 450 100 15 false true true 0 sim/gui/dialogs/metar/description[0] vbox 1 hbox true /environment/metar/valid hbox metar-string-input fill true 70 15 true true 0 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-input hbox true vbox 1 true hbox true