mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Ref T658, matching script examples
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
Use your own directory to store your scripts!
|
||||||
|
This directory will be overridden.
|
||||||
@@ -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
|
// 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
|
// inObject values as from network
|
||||||
// outObject to be returned back to matching engine
|
// outObject to be returned back to matching engine
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
// the logic we implement
|
// the logic we implement
|
||||||
var lm = "";
|
var lm = "";
|
||||||
if (inObject.callsign == 'DAMBZ') {
|
if (inObject.callsign === 'DAMBZ') {
|
||||||
var ms = "PIPER CHEROKEE 180"; // must exist in model set
|
var ms = "PIPER CHEROKEE 180"; // must exist in model set
|
||||||
if (modelSet.containsModelString(ms)) {
|
if (modelSet.containsModelString(ms)) {
|
||||||
lm = "Model set contains ";
|
lm = "Model set contains ";
|
||||||
|
|||||||
@@ -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() {
|
(function() {
|
||||||
// inObject
|
// inObject
|
||||||
// outObject
|
// outObject
|
||||||
// modelSet, not available in reverse lookup
|
// modelSet, not available in reverse lookup
|
||||||
outObject.aircraftIcao = "C172";
|
outObject.aircraftIcao = "C172";
|
||||||
outObject.modified = true;
|
outObject.modified = true; // tell we changed something
|
||||||
outObject.rerun = true;
|
outObject.rerun = true; // treat the changed values as coming from network
|
||||||
outObject.logMessage = "Changed to C172";
|
outObject.logMessage = "Changed to C172"; // just logging
|
||||||
|
outObject.modelString = ""; // invalidate any model
|
||||||
|
outObject.dbModelId = -1; // invalidate
|
||||||
|
|
||||||
return outObject;
|
return outObject;
|
||||||
|
|
||||||
// string return is possible
|
// string only return is possible
|
||||||
// return "Changed ICAO to C172";
|
// return "Changed ICAO to C172";
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user