mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T658, matching script examples
This commit is contained in:
committed by
Mat Sutcliffe
parent
7b6650db32
commit
5507aa05ee
@@ -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
|
||||
// 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 ";
|
||||
|
||||
@@ -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";
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user