# API Reference - COMMAND
All commands are listed below.
# #comment
#comment
is used to add human-readable information within command lists. It has no effect and runs instantly.
Examples:
{"#comment": "This section of code is very delicate"},
{"#comment": [
"This section of code is very delicate",
"This section of code is very delicate",
"This section of code is very delicate"
]},
# sleep
sleep
is used to wait or delay execution for some time.
Examples:
{"sleep": QUERY},
{"sleep": 0.25},
{"sleep": 1},
{"sleep": {"rand":[0, 60]}},
{"sleep": {"var":["L:MY_SLEEP_TIME", "number]}},
{"sleep": "forever"},
# wait_for
wait_for
will not proceed to the next command until the comparison between QUERY_1 and QUERY_2 is satisfied.
Format:
{"wait_for": QUERY_1, "eq": QUERY_2},
Where eq
is the operator, and it can be any of
Operator | Function |
---|---|
eq | Equal To |
ne | Not Equal To |
lt | Less Than |
lte | Less Than Or Equal To |
gt | Greater Than |
gte | Greater Than Or Equal To |
Examples:
{"wait_for": {"var":["L:MY_TEST_VAR", "number"]}, "eq": 1},
# if
if
allows to check a condition (one time) and then proceed down the then
branch of commands, or optionally the else
branch of commands. Once the selected branch is executed, processing returns to the next command after if
.
Format:
{"if": QUERY_1, "eq": QUERY_2, "then": COMMANDLIST},
{"if": QUERY_1, "eq": QUERY_2, "then": COMMANDLIST, "else": COMMANDLIST},
Where eq
is an operator and using the same list as wait_for
.
Examples:
{"if": 1, "eq": 1, "then":[
{"set_message":{"text":"1 is always equal to 1}}
], "else":[
{"set_message":{"text":"this never executes, since 1 always equals 1"}}
]},
# while
while
enables to run a do
COMMANDLIST until a condition is satisfied.
Format:
{"while": QUERY, "do": COMMANDLIST}
Examples:
{"while": {"var":["L:MY_TEST_VAR","number"]}, "gt": 1, "do":[
{"set_message":{"text":"this message runs over and over while L:TEST_VAR is greater than 1"}}
]},
{"set_message":{"text":"this message runs once, after L:MY_TEST_VAR becomes less than one"}},
# for_each
for_each
is used to call a do
COMMANDLIST for each element in an array. $index
and $item
params will be defined for each iteration.
Format:
{"for_each": QUERY, "do": COMMANDLIST},
Examples:
{"for_each": {"create_array": 4}, "do": [
{"set_message": {"text": "my array item: idx={0} item={1}", "params": [{"param": "$index"},{"param": "$item"}]}},
{"sleep":5}
]},
--------------------------------------------------
{"set":{"param":"my_array"}, "value":[1,2,3,4]},
{"set":{"param":"my_result_array"}, "value":[]},
{"for_each":{"param":"my_array"}, "do":[
{"if":{"param":"$index"},"eq":1, "then":[
{"continue":1}
]},
{"if":{"param":"$index"},"eq":3, "then":[
{"break":1}
]},
{"modify_array":{"param":"my_result_array"}, "append":{"param":"$index"}}
]},
{"set_message":{"text":"ret={0}", "params": [
{"json:stringify": {"param":"my_result_array"}}
]}},
# try
try
and catch
may be used to trap an error which would otherwise result in a message to the user. $ERROR
will be defined with the error result.
Examples:
{"try":[
{"set": {"object":""}}
], "catch":[
{"set_message":"oops! {$ERROR}"}
]},
# switch
switch
is used to select from a set of known results (each a COMMANDLIST
).
Examples:
{"switch":2, "case":{
"0": [ {"set_message":"You selected 0"} ],
"1": [ {"set_message":"You selected 1"} ],
"2": [ {"set_message":"You selected 2"} ],
"default": [ {"set_message":"You selected another number"} ]
}},
# set
set
enables setting variables in MSFS and in the mission system and on mission objects. You may prefix the MSFS events with K:
, the list is available here (opens new window)
Examples:
{"set": {"object": "my_object", "var":"MODE"}, "value": QUERY}
{"set": {"var":["L:TEST", "number"]}, "value": QUERY}
{"set": {"table":"my_table", "key":{"text":"blah{0}","params":[99]}}, "value": QUERY}
{"set": {"local":"my_local"}, "value": QUERY}
{"set": {"param":"my_param"}, "value": QUERY}
{"set": {"global":"my_global"}, "value": QUERY}
# trigger
trigger
is a shorthand which is intended to be used to send H:
and K:
events to the sim.
You can send all of the HPG SDK events to the aircraft, and any of the applicable Sim Events (opens new window).
Examples:
{"trigger": "H:MY_EVENT"}
{"trigger": ["H:EVENT_1", "H:EVENT_2"]}
# call_macro
call_macro
will synchronously call a macro by name
. Macros can be defined within the mission or some are built into the product as "system macros".
Macros that use the return
command will have their result available via the $RET
param after the call is complete. You can change $RET
to another param name by using result
.
Examples:
{"call_macro": "do_it_now"}
{"call_macro":"my_calc", "params":{"num1":2, "num2":4}}
{"call_macro":"my_calc", "params":{"num1":2, "num2":4}, "result": "my_result"}
# return
return
is used to set $RET
on the calling context, when the function returns.
return
will also stop processing further commands on the macro (except for threads, which keep running).
Examples:
{"return": QUERY}
{"return": {"param":"my_ret"}}
{"return": "ERROR"}
# break
break
is used to escape from a loop (see for_each
). After break
, no more iterations of the loop will execute.
# continue
continue
is used to escape from a single loop (see for_each
) iteration but still continue on the next iteration.
# private_macros
private_macros
enables you to provide a list of macros which is visible only within that scope.
Examples:
{"private_macros":{
"my_macro_name: [
{"#comment":"macro commands here"}
]
}}
# create_thread
create_thread
enables running code (a COMMANDLIST
) asynchronously.
commands
: required.interval
: optional. default to 100ms
Examples:
{"create_thread": {"commands":[
{"sleep": 100},
{"set_message":{"text":"this runs 100 seconds later!}}
]}}
{"set_message":{"text":"this runs instantly and the next command continues}}
# create_event_handler
create_event_handler
enables you to listen for MSFS H:Events.
Examples:
{"create_event_handler": "BAMBI_BUCKET_DUMPED", "commands":[
{"set_message":{"text":"bambi dumped!"}}
]}
# throw_error
throw_error
enables you to create a custom error.
Examples:
{"try":[
{"throw_error":"my custom error message"}
], "catch":[
{"set_message":"oops! {$ERROR}"}
]},
# modify_array
modify_array
enables some common array operations, like prepending or appending items, or removing an item at an index.
Examples:
{"modify_array":{"local": "my_array"},"append": QUERY}
{"modify_array":{"local": "my_array"},"prepend": QUERY}
{"modify_array":{"local": "my_array"},"removeIndex": QUERY}
# reload_mission
reload_mission
enables resetting the mission without clearing locals
.
Examples:
{"reload_mission": 1}
# load_mission
load_mission
enables calling another mission (the current mission will end). The locals
will not be cleared.
Examples:
{"load_mission":"other_mission_id"}
# create_object
create_object
instantiates a new AI object in the world. It will be referred to by its name
. Object names must be unique, and subsequent calls to create_object
will fail with the same name. Use destroy_object
to remove an object when you are finished with it.
name
: this is the name that is used to reference the object in subsequent calls likeset
,drive_object
anddestroy_object
.title
: this is thetitle
from aircraft.cfg/sim.cfg in MSFS, which uniquely identifies the object.fallback_title
: Shouldtitle
fail to exist, usefallback_title
automatically.location
: this is theLOCATIONREF
where the object should be created.is_flight_object
: 1 or 0 depending on whether this is an object which should fly or not.is_ground_object
: 1 or 0 depending on whether this is an aircraft.cfg object or a sim.cfg object.is_static_object
: 1 or 0 depending on whether this is a static type simobject
Examples:
{"create_object":{
"name": "my_object",
"title": "HPG Airbus H145 Ambulance",
"location": "$USER"
}}
# destroy_object
destroy_object
will deallocate an object and wait for it ot be destroyed. It is valid to re-use the object name after this point (create_object
with the same name).
Examples:
{"destroy_object": QUERY}
{"destroy_object": "my_object"}
# track_object
track_object
will add an icon to the map which follows the specific object. track_object
uses a thread to so its work, and it returns immediately.
icon
may be either:
- data-uri for a 44x44 PNG image
- a string referring to the
icons
table in the mission, which contains (1) - a string referring to a
known icon
(see table below)
Known icons:
Icon | Description |
---|---|
ki_waypoint_blue | Waypoint (blue) |
ki_target | Target symbol |
ki_helipad | Helipad symbol |
ki_medic | Medic symbol |
Examples:
{"track_obejct": {"object": QUERY, "icon": QUERY}}
{"track_object": {"object": "my_object", "icons": "ki_medic"}}
# drive_object
drive_object
will send an object along waypoint navigation, and returns only when the object has finished.
name
: The name of the object to drive.speed
: Speed to use during the drive, meters per second.to
: ARRAY ofLOCATIONREF
or aROUTE
data
: This isset_drive_data
data.VAR1
: Value to setVAR 1
on the mission object, during teh drive.
Examples:
{"drive_object": {"name": "soldier_1", "to": ["pax_right_door"], "VAR1": 2, "speed": 10}},
{"drive_object":{
"name":"tanker1",
"to":[
[34.921710973784805, -117.88296989234365, 2200, 100],
[34.91159609892966, -117.90097049623692, 2500, 100],
[34.894605381452905, -117.90550330903535, 2600, 100],
[34.90274380665833, -117.86989409383754, 2700, 100],
[34.91631769396497, -117.86277032013513, 2800, 100]
],
"speed":100,
"data": {
"use_safety_height": true,
"safety_height": 100,
"max_vertical_speed": 50,
"max_vertical_speed_heightdelta": 100
}
}},
# move_object
move_object
will teleport an object to a new location.
Examples:
{"move_object": QUERY, "to": LOCATIONREF}
{"move_object": "my_object", "to": "$USER"}
# point_object
point_object
enables orienting an object to point at another object.
Examples:
{"point_object": QUERY, "to": LOCATIONREF}
{"point_object": "my_object", "to": "$USER"}
# set_drive_data
set_drive_data
lets you configure drive_object
behaviors after calling drive_object
(mid-drive).
use_safety_height
: Determines whether a flying object is restricted to the safety height (floor).safety_height
: safety height (minimum radio altitude). feet.max_vertical_speed
: Determines the flight objects maximum vertical climb/descend speedmax_vertical_speed_heightdelta
: Determines at which altitude delta will result in maximum speed. Values beyond this point will be clamped.
Examples:
{set_drive_data: {
"use_safety_height": true|false,
"safety_height": 0
"max_vertical_speed": 0
"max_vertical_speed_heightdelta": 0
}}
# set_df
set_df
can be used to set the active Direction Finder signal location. (DF source on the MFD).
Examples:
{"set_df": {"location": LOCATIONREF, "freq": QUERY}}
{"set_df": {"location": "my_boat", "freq": 255.0}}
# set_carls_radio
set_carls_radio
will set the displays of the CARLS TACTICAL RADIO in the cockpit.
Examples:
{"set_carls_radio": {
"LSK": ["PG1", "", ""],
"RSK": ["", "", "INOP"],
"Items": [
["Group 1", "misc contacts"],
["Group 2", "important"],
["Group 3", "other"]
]
}}
{"set_carls_radio": {
"LSK": ["PG1", "", ""],
"RSK": ["", "", "INOP"],
"Items": [
["Group 1", "misc contacts"],
{"item": ["Group 2", "important"], "show_condition": ...}
[{"text": {"Group 3 {0}=99, {1}=88"}, "params": [99, 88]}, "other"]
]
}}
A full sample program is available at Samples.
# set_tfm_radio
set_tfm_radio
works similarly to set_carls_radio
.
Examples:
{"set_tfm_radio":{
"main": [
["DISPATCH", "168.9000"],
["BKP DISP", "169.0000"],
],
"guard":[
["GUARD 1 NAME", "164.350" ],
["GUARD 1 NAME", "168.350" ]
]
}},
{"set_tfm_radio":{
"main": [
["DISPATCH", "168.9000"],
["BKP DISP", "169.0000"]
],
"guard":[
{"item":["G1 NAME", "165.0000"], "show_condition":{"require":2,"eq":2}},
[{"text":"G{0} NAME","params":[99]}, "167.0000"],
["G 3 NAME", "164.350" ],
["G 4 NAME", "168.350" ]
]
}},
# set_rescuetrack
set_rescuetrack
configures the DMAP RescueTrack UI.
Examples:
{"set_rescuetrack":null},
{"set_rescuetrack":{
"statusVar": "L:MY_DISPATCH_STATUS",
"statusMessages": {"static": "statusMessages"},
"dispatcherMessages": {"local": "Messages"},
"activate_waypoint_commands":[
{"#comment":"param - $index - in dispatcherMessages"},
{"#comment":"param - $command - DIRECTTO"},
{"set_message":"{$index} {$command}"},
{"set_route": {"struct": {"struct":{"local": "Messages"}, "index": {"param": "$index"}}, "path":"waypoint"}},
{"#comment":""}
]
}}
{"set_rescuetrack":{
"statusVar": "L:MISSION_RESCUETRACK_STATUS",
"statusMessages": [
"1. Unavailable for dispatch",
"2. Ready for dispatch",
"3. Dispatch accepted, en route to scene"
],
"dispatcherMessages": [
{
"from": "My Dispatcher",
"time": "00:16:00",
"text": "the accident site is now clear, proceed to the destination",
"waypoint": [0, 0]
},
{
"from": "My Dispatcher",
"time": "00:07:00",
"text": "the accident site is blocked, enter a hold",
"waypoint": [0, 0]
}
]
}},
# open_door
open_door
will open the aircraft door if it is not already open. if it opens the door, it will also wait for it to finish opening.
Examples:
{"open_door": "cockpit_left"}
{"open_door": "pax_left"}
{"open_door": "cargo_left"}
# close_door
close_door
will close the aircraft door if it is not already closed. if it closes the door, it will also wait for it to finish closing.
Examples:
{"close_door": "cockpit_right"}
{"close_door": "pax_right"}
{"close_door": "cargo_right"}
# create_fire
create_fire
will create a set of fires.
size
: Count of fires to starttitle
: Fire object name, such asAirbus h145 Fire
.showIcon
: Optional. Defaulttrue
. whether or not to show icons for the fires.L:DEBUG_CREATE_FIRE_DIST_MULT
: (with default)L:DEBUG_CREATE_FIRE_SIZE_MULT
: (with default)
Examples:
{"create_fire": "fire_spawn_area", "size": {"var": ["L:MISSION_FIRE_SIZE", "number"]}, "title": "Airbus H145 Fire"},
# launch_missile
launch_missile
will spawn and launch a projectile from one object to another.
Examples:
{"launch_missile": {
"from": "my_ai_fighter_jet",
"to": "$USER"
}}
# designate_target
designate_target
enables setting a target in the targetting computer.
Examples:
{"designate_target: "my_target_object"}
{"designate_target: {"location": LOCATIONREF, "alt": QUERY}}
{"designate_target: {"location": "my_target_ground_location", "alt": 1500}}
# set_route
set_route
can be used to set direct-to flight plan on the map
Examples:
{"set_route": LOCATIONREF}
{"set_route": "my_location"}
# set_map
set_map
can be used to:
- Add, remove or updates points on the map. Points may have an icon and/or text.
- Add or remove lines on the map
Examples:
{"set_map":{"add":{"point":{"location":"$USER", "icon":"ki_helipad", "text":"waypoint text"}}}}
{"copy_location":{"bearing":330,"dist":500},"to":"P1"},
{"copy_location":{"bearing":30,"dist":500},"to":"P2"},
{"copy_location":{"bearing":120,"dist":500},"to":"P3"},
{"copy_location":{"bearing":240,"dist":500},"to":"P4"},
{"set_map":{"add":{"line":{ "points":["P1","P2","P3","P4", "P1"], "stroke":{"color":"#4287f5", "width":4}}}}},
{"set_map":{"add":{"point":{"location":"P1","text":"waypoint text"}}}},
{"set_map":{"add":{"point":{"location":"P4","icon":"ki_helipad"}}}},
# wait_modal
wait_modal
can display the (singleton) modal dialog to the user. The user can pick a choice to continue.
Examples:
{"wait_modal": {
"title": "Mission Parameters",
"text": "Select a sling activity",
"options": [
{"text": "Utility", "style": "primary", "commands": [
{"#command": "use a sleep 0 here to make sure button with empty list still executes"}
{"sleep": 0}
]},
{"text": "Logging", "style": "", "commands": [
{"set": {"object":"cargo", "var":"VAR 1"}, "value": 8},
{"set": {"object":"cargo2", "var":"VAR 1"}, "value": 8},
{"set": {"object":"cargo3", "var":"VAR 1"}, "value": 8},
{"set": {"object":"cargo4", "var":"VAR 1"}, "value": 8}
]}
]
}}
# set_modal
set_modal
works exactly the same as wait_modal
, but does not wait for execution to continue.
# set_message
set_message
displays a message on the bottom of the mission app.
align
may beleft
,center
, orright
.size
may besmall
,medium
,large
, orextralarge
.color
may beblue
,red
,green
,orange
,purple
,hotpink
,brown
,cyan
, oryellow
.
Examples:
{"set_message":{"text":"hello"}}
{"set_message":{"text":"hello {0}", "params":[ "dave" ]}}
{"set_message":{"text":"hello {0}", "params":[ {"local":"my_local"}]}}
# set_progressbar
set_progressbar
will enable display of a progress bar at the bottom of the mission app.
Examples:
{"set_progressbar":{"min":0,"max":100,"var":["L:TEST","number"], "color":"green"}}
{"set_progressbar":null}
# set_dispatch
set_dispatch
allows setting the dispatch dialog content. This is similar to the briefing but can be changed during the mission. All of the same widgets from the briefing are available.
Examples:
{"set_dispatch": [
{"text":"hello world"}
]}
# set_briefing_dialog
set_briefing_dialog
opens or closes the briefing dialog.
Examples:
{"set_briefing_dialog": QUERY}
{"set_briefing_dialog": 1}
{"set_briefing_dialog": 0}
# set_dispatch_dialog
set_dispatch_dialog
opens or closes the dispatch dialog.
Examples:
{"set_dispatch_dialog": QUERY}
{"set_dispatch_dialog": 1}
{"set_dispatch_dialog": 0}
# scroll_to_briefing_item
scroll_to_briefing_item
will scroll to the named section on the briefing page.
Examples:
{"scroll_to_briefing_item: "header1"}
# scroll_to_dispatch_item
scroll_to_dispatch_item
will scroll to the named section on the dispatch page.
Examples:
{"scroll_to_dispatch_item: "header1"}
# set_objective_title
set_objective_title
enables changing the objective title (text at the bottom of the mission app) at a time other than when the objective list itself moves to the next objective.
color
may beblue
,red
,green
,orange
,purple
,hotpink
,brown
,cyan
, oryellow
.
Examples:
{"set_objective_title":QUERY}
{"set_objective_title":"Fly to the target"}
# set_hover_display
set_hover_display
enables you to show a target crosshairs on the mission map.
range
: meters
Examples:
{"set_hover_display": {"target":LOCATIONREF,"range":QUERY}},
{"set_hover_display": {"target":"load1_dest","range":0.02}},
# create_user_action
A User Action is a command available for the user to click, shown at the top of the mission map.
create_user_action
will create the named user action. click_commands
is a COMMANDLIST which will be run if the user clicks the button or invokes the hotkey.
Examples:
{"create_user_action": {
"id": "accept_dispatch",
"title": "Accept Dispatch",
"click_commands": [
{"destroy_user_action":"accept_dispatch"}
]
}},
{"create_user_action": {"id": "change_accident_location", "title": "Change Location", "click_commands": [
{"set_message": {"text": ""}},
{"call_macro": "user_pick_accident_location"},
{"set_route": "accident_location"},
{"set_message": {"text": "Accident Location: {0:LOCATION}", "params": [ "accident_location" ]}}
]}},
# destroy_user_action
destroy_user_action
will remove an existing user action.
Examples:
{"destroy_user_action: "my_action"}
# trigger_user_action
trigger_user_action
will manually trigger a user action, as if clicked by the user.
Examples:
{"trigger_user_action": "my_action"}
# set_user_poi
set_user_poi
will enable clicking on the map on behalf of the user.
Examples:
{"set_user_poi: LOCATIONREF}
{"set_user_poi: $"USER"}
{"set_user_poi: [33.2, -112.4]}
# clear_user_poi
clear_user_poi
will clear any map POI selection.
Examples:
{"clear_user_poi: 1}
# create_route
create_route
uses an online service to compute instructions to transit using the road network from one location to another. After calling create_route
, the name
will be available to reference with other APIs.
type
: Optional. Default tocar
.
Examples:
{"create_route": {name: "route-name-here", "query": {
"location_from": LOCATIONREF,
"location_to": LOCATIONREF,
"type": "car|foot|bike"
}}}
{"create_route": {name: "my_route_name", "query": {
"location_from": "$USER",
"location_to": {"bearing":0, "dist": 1000},
"type": "car"
}}}
# draw_route
draw_route
will draw lines on the map for the specified route.
stroke
: Optional. default is {width: 8, color: '#FF33FF' }
Examples:
{"draw_route": "route_name", "id":"my_route_id"}
# copy_stringtoken
copy_stringtoken
copies a string token by name to another name.
Examples:
{"copy_stringtoken": "token1", "to": "token2"}
# open_url
open_url
opens a web browser window on the user's PC.
Examples:
{"open_url": QUERY}
{"open_url":"https://hypeperformancegroup.com/"}
# copy_location
copy_location
will take a LOCATIONREF, resolve it right now, and then save it under a new name.
Examples:
{"copy_location":LOCATIONREF, "to": "my_new_location_name"}
{"copy_location":"my_location_name", "to": "my_new_location_name"}
# open_location
open_location
will open Google Maps to a specific LOCATIONREF
Examples:
{"open_location": LOCATIONREF}
{"open_location": "object1"}
{"open_location": [34.1, -122.9]}
# create_location
create_location
will create a location name by selecting from the provided zones
and creating the location from the zone's information. Zones are picked randomly from the list, you can simply provide one if you like.
Format:
{"create_location": "location_name", zones: [ZONE]}
{"create_location": "location_name", zones: [ZONE1, ZONE2, ZONE3, ...]}
{"create_location": "location_name", zones: [ZONE], no_results_commands: COMMANDLIST}
no_results_commands
: Optional. By default a modal dialog will be created when the data query does not succeed.
A ZONE
is has these properties:
location
:LOCATIONREF
which is the center of the zone.radius
: Radius of the zone in meters.minRadius
: Optional. Defaults to0
. meters.commands
:COMMANDLIST
which will be run.$LOCATION:NAME
param will have the location friendly name.zone_type
: Select from the list below.query
:DATAQUERY
(only if a data query zone)
Zone Types:
Zone | Description |
---|---|
random_point | Pick a random position inside this location. |
query_list_result | Data Query: Execute the query and then present a list of results for the user to choose from. |
query_random_result | Data Query: Execute the query and then pick a random result |
query_closest_result | Data Query: Execute the query and then pick the closest result. If the query fails, increase the range and try again until there is a result. |
If a data query is selected, the following parameters will be populated after call:
$LOCATION:NAME
the name tag on the result.$LOCATION:ID
the id on the result.
Examples:
{"create_location": "$LOCATION", "zones": [
{"zone": {
"zone_type": "query_closest_result",
"query": "[out:json];way({{bbox}})[highway~\"^(motorway|trunk|primary|secondary|tertiary|(motorway|trunk|primary|secondary)_link)$\"]->.major;way({{bbox}})[highway~\"^(unclassified|residential|living_street|service)$\"]->.minor;node(w.major)(w.minor);out;",
"location": "city_center",
"radius": 25000,
"minRadius": 0,
"commands": []
}}
]}
# query_data
query_data
lets you query for OSM data and get a callback for the results.
Note that this is a legacy API before for_each
.
location
:LOCATIONREF
query
:DATAQUERY
radius
: meters.minRadius
: Optional. defaults to0
commands
: ARRAY OFCOMMANDLIST
to run for each result.no_results_commands
:COMMANDLIST
to run if there is not enough results (length of )$LOCATION
(usable temporary location name) will be defined differently in each call back tocommands
.$LOCATION
(param) will be defined differently in each call back tocommands
.$LOCATION:NAME
(param) will have the location friendly name.
Use bypass_commands
and $ITEMS
to process the full list.
Examples:
{"query_data": {
"query": "[out:json]; ( node({{bbox}})[power=substation]; area({{bbox}})[power=substation]; ); out center;",
"location": "city_center",
"radius": 25000,
"minRadius": 0,
"commands": [
[{"set": {"var": ["L:MISSION_LOC_POWER_0", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_0", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_1", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_1", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_2", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_2", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_3", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_3", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_4", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_4", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_5", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_5", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_6", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_6", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_7", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_7", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_8", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_8", "number"]}, "value": 0}],
[{"set": {"var": ["L:MISSION_LOC_POWER_9", "number"]}, "value": {"location": "$LOCATION"}}, {"set": {"var": ["L:MISSION_SCORE_POWER_9", "number"]}, "value": 0}]
]
}}
# query_country
query_country
lets you identify the country name (string) for a location.
None
is a special country name that refers to the open ocean.$COUNTRY
(param) will be defined after the call returns.$COUNTRY
(stringToken) will be defined after the call returns.
Examples:
{"query_country": {
"United States of America": [ {"set_message": {"text": "USA country $COUNTRY" }} ],
"France": [ {"set_message": {"text": "FR country" }} ],
"Germany": [ {"set_message": {"text": "DE country" }} ],
"Other": [ {"set_message": {"text": "Other country: $COUNTRY" }} ],
"None": [ {"set_message": {"text": "You are over open water. ($COUNTRY)" }} ]
}, "location":[65.34528194493097, -12.372530650689942]}
# osm_query_data
Use osm_query_data
to query OSM for data within a specific area. Operations on the data after osm_query_data
will not use the network.
Examples:
{"#comment":"Query a block of road network data and save it into my_data"},
{"osm_query_data":
"[out:json];way({{bbox}})[highway~\"^(motorway|trunk|primary|secondary|unclassified|residential|living_street|service|tertiary|(motorway|trunk|primary|secondary|tertiary|)_link)$\"];(._;>;);out;",
"location":"LOC",
"size": 600,
"result":"my_data"
},
# osm_get_parent_ways
Given a NodeId
, osm_get_parent_ways
will provide an array of the ways which contain that id. Use this to find out which roads a given node belongs to.
Examples:
{"osm_get_parent_ways":{"struct":{"param":"$item"},"path":"id"}, "data": {"param":"my_data"}, "result":"parents"},
# osm_get_connected_nodes
Use osm_get_connected_nodes
to discover nodes which are adjacent to the given nodeId
. This is good for finding the legs of an intersection, or the up/down nodes along a road.
Examples:
{"osm_get_connected_nodes":{"struct":{"param":"closest_node"},"path":"id"}, "data": {"param":"my_data"}, "result":"my_nodes_connected_to_nearest_node"},
# osm_get_nodes
Use osm_get_nodes
to get an ordered list of all the nodes within a given wayId
. Use this to get a list of coordinates along a road.
Examples:
{"osm_get_nodes":{"struct":{"param":"$item"}, "path":"id"}, "data": {"param":"my_data"}, "result":"my_nodes_on_way"},
# osm_get_all_ways
Use osm_get_all_ways
to get a list of all the ways within the data set.
Examples:
{"osm_get_all_ways": {"param":"my_data"}, "result":"my_ways"},
# osm_get_all_nodes
Use osm_get_all_ways
to get a list of all the nodes within the data set.
Examples:
{"osm_get_all_nodes": {"param":"my_data"}, "result":"my_nodes"},
# osm_get_closest_nodes
Use osm_get_closest_nodes
to create an ordered list of nodes, ranked by the distance to the given LOCATIONREF
.
Examples:
{"osm_get_closest_nodes": "LOC", "data": {"param":"my_data"}, "result":"my_closest_nodes"},
# osm_is_point_within_way
Use osm_is_point_within_way
to determine if a given LOCATIONREF
lies within the closed way.
Examples:
{"osm_is_point_within_way": {"struct":{"param":"way"}, "path":"id"}, "location":{"bearing":{"param":"brg"},"dist":{"param":"dist"}}, "data":{"param":"my_data"},"result":"is_in"},
# osm_get_area_of_area
Use osm_get_area_of_area
to measure the area of the closed way, in meters squared.
Examples:
{"osm_get_area_of_area":{"struct":{"param":"way"},"path":"id"}, "data": {"param":"my_data"}, "result":"way_area"},
# open_table
open_table
opens an existing data table, or creates a new one. Once the table is open, table commands are valid.
Examples:
{"open_table": QUERY}
{"open_table": "my_table"}
# save_table
save_table
will immediately persist the table to disk. Changes made to tables where save_table
is not eventually called (before leaving the mission) will be lost.
Examples:
{"save_table": QUERY}
{"save_table": "my_table"}
# clear_table
clear_table
will remove all keys from a table.
Examples:
{"clear_table": QUERY}
{"clear_table": "my_table"}
# play_audio
play_audio
enables playback of built-in audio sounds. play_audio
will not proceed until the sound finishes playing.
Examples:
{"play_audio": "hold_position"}
{"play_audio": "4"}
Sound list:
0 1 2 3 4 5 6 7 8 9 10
we_are_not_in_range
we_are_too_high
we_are_too_low
hold_position
the_cabin_is_secure
forward
backward
left
right
ready_for_you_to_approach_and_hoist
ready_for_you_to_approach_and_land
tablet_alarm1
# play_guidance_message
play_guidance_message
can be used to provide audio guidance to a target.
target
: The remote target to provide guidance toself
: This is the position on your aircraft that should match the center of the target object, such as$USER:HOIST
for the hoist fixture position.
Examples:
{"play_guidance_message": {"target": LOCATIONREF, "self": LOCATIONREF}},
{"create_thread": {"name": "main_crash_guidance_thread", "commands": [{"while": {"var": ["L:MISSION_GUIDANCE_ENABLED", "number"]}, "eq": 1, "do": [
{"wait_for": {"location": "main_crash", "var": "distance"}, "lt": 0.03},
{"play_guidance_message": {"target": "main_crash", "self": "$USER:HOIST"}},
{"sleep": 2}
]}]}}
# connect_voice_server
connect_voice_server
will attempt to connect to the defined voice service. on_connected
commands will be run on success, on_disconnected
will run on disconnect, even if much later.
Examples:
{"connect_voice_server": {
"on_connected":[
{"speak":"Speech activated."}
],
"on_disconnected":[
{"set_message":{"text":"No voice server available"}}
]
}}
# speak
speak
will send a command to the voice server to play text-to-speech or an audio file.
interrupt
: 1 or 0. 1 will cancel the queue and play immediately.
is_audio_file
: 1 or 0. 1 will assume the text is a filename.wav
in the audio
directory available to the server.
Examples:
{"speak":"hello"}
{"speak":{"text":"hello {0}", "params":["dave"]}}
{"speak":"hello.wav", "is_audio_file":1}
# Debugger & Remote Commands
# cancel_debugger
cancel_debugger
should be used by non-debug remote missions, this will suppress the extra debugger activity.
- This command applies when using a remote context (a mission connected via websocket) or when using the debugger (a tool based on the same rpc).
# remote_notify
remote_notify
will report data to the remote server, if available.
- This command applies when using a remote context (a mission connected via websocket) or when using the debugger (a tool based on the same rpc).
Examples:
{"remote_notify":"my_connected_event"}
{"remote_notify":"hello_event", "params":[
{"var":["A:PLANE ALTITUDE","feet"]},
{"var":["A:PLANE BANK DEGREES","bank"]}
]}
# teleport_to
teleport_to
will set the latitude and longitude of the player aircraft, instantly teleporting them.
Note that this needs some work to engage slew mode for the user and adjust the altitude.
# fetch
fetch
enables interaction with remote web services using the javascript fetch
API.
Examples:
{"fetch": {
"url": "http://127.0.0.1:3000/report?key=hello",
"method": "POST",
"headers":{
"Accept": "application/json",
"Content-Type": "application/json"
},
"body": {"param":"msg"}
}},
# set_shared_data
set_shared_data
will mutate multiplayer shared data state. It implicitly uses the last created multiplayer connection.
Example:
{"set_shared_data":"update","path":"connectedAircraft.{service_auth}.isHost", "value": true},
# debug_write
debug_write
sends a string to console.log
.
# hoist_control
hoist_control
enables reeling in or out the hoist cable. See the hoist topic for more.
Examples:
{"hoist_control": "reel_down","speed": 1}
{"hoist_control": "reel_up","speed": 1}