diff --git a/resources/share/matchingscript/Do not store your scripts here.txt b/resources/share/matchingscript/Do not store your scripts here.txt new file mode 100644 index 000000000..bcc3ed979 --- /dev/null +++ b/resources/share/matchingscript/Do not store your scripts here.txt @@ -0,0 +1,2 @@ +Use your own directory to store your scripts! +This directory will be overridden. \ No newline at end of file diff --git a/resources/share/matchingscript/matchingDemo.js b/resources/share/matchingscript/matchingDemo.js index 8a1d5e794..91b7c7b58 100644 --- a/resources/share/matchingscript/matchingDemo.js +++ b/resources/share/matchingscript/matchingDemo.js @@ -1,6 +1,6 @@ -// this is a demo file demonstrating some capabilities of the +// This is a demo file demonstrating some capabilities of the // matching script engine -// this script runs after(!) the matching has been completed +// This script runs after(!) the matching has been completed // // inObject values as from network // outObject to be returned back to matching engine @@ -17,7 +17,7 @@ // the logic we implement var lm = ""; - if (inObject.callsign == 'DAMBZ') { + if (inObject.callsign === 'DAMBZ') { var ms = "PIPER CHEROKEE 180"; // must exist in model set if (modelSet.containsModelString(ms)) { lm = "Model set contains "; diff --git a/resources/share/matchingscript/reverseDemo.js b/resources/share/matchingscript/reverseDemo.js index 54a884cd9..69d3076fd 100644 --- a/resources/share/matchingscript/reverseDemo.js +++ b/resources/share/matchingscript/reverseDemo.js @@ -1,14 +1,29 @@ +// This is a demo file demonstrating some capabilities of the +// matching script engine +// This script runs after(!) the reverse lookup has been completed +// +// inObject values as from network +// outObject to be returned back to matching engine +// matchedObject the result so far, same as inObject for reverse lookup +// modelSet user's current model set, not available in reverse lookup +// webServices wraps access to swift web services +// +// outObject.rerun = true => rerun matching or reverse lookup after the value has been changed again, like a 2nd pass +// outObject.modified = true => tell matching or reverse lookup that something has been changed +// (function() { // inObject // outObject // modelSet, not available in reverse lookup outObject.aircraftIcao = "C172"; - outObject.modified = true; - outObject.rerun = true; - outObject.logMessage = "Changed to C172"; + outObject.modified = true; // tell we changed something + outObject.rerun = true; // treat the changed values as coming from network + outObject.logMessage = "Changed to C172"; // just logging + outObject.modelString = ""; // invalidate any model + outObject.dbModelId = -1; // invalidate return outObject; - // string return is possible + // string only return is possible // return "Changed ICAO to C172"; })