This article covers the following platforms
MSFS 2024
MSFS 2020
ATS
FSX
Prepar3D
Use script messaging to send any JavaScript value to scripts with a matching reference name.
script_message_send()
Send a message to matching scripts and receive their replies.
SignatureTypeScript contract
script_message_send(
reference_name: string,
message: unknown,
callback: (reply: object) => void
): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
reference_name | string | Yes | Reference name of the script or scripts to find. |
message | unknown | Yes | Value to send. It can be any JavaScript value. |
callback | (reply: object) => void | Yes | Function that receives a configured reply. |
ExampleJavaScript
this.$api.command.script_message_send(
"weather-tools",
{ action: "refresh" },
(reply) => console.log(reply)
);Returns
voidReplies are delivered to the callback.Callback data
| Name | Type | Description |
|---|---|---|
reply | object | Reply from a matching script when that script is configured to respond. |