guess the code explains it better then I could
lookup atis on change of airport
##below is working but need to eliminate error if no ATIS or different name aka eham egkk loih
- Code: Select all
var airport = airportinfo(getprop("sim/presets/airport-id"));
var atis = airport.comms('atis');
if (!size(atis))
atis = airport.comms('awos');
printf('%s %.2f', airport.id, size(atis) ? atis[0] : 'Not found');
setprop("/systems/catis",atis[0]);
setprop("/instrumentation/comm/frequencies/selected-mhz", (getprop("/systems/catis")));
### if atis is not 0 it throws up the following nasal error in the console
Nasal runtime error: vector index 0 out of bounds <size:0> at ....
So the question is how to prevent that runtime error ? Thanks