plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

RoscoHead avatar image
RoscoHead asked RoscoHead commented

Display messages from WASM module

Is it possible to display messages on-screen (similar to ATC call-outs) from a stand-alone WASM module?

wasmdevs
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

tml avatar image
tml answered RoscoHead commented

If you mean for debugging purposes, then any output to stdout or stderr shows up in the "Console" window of the Dev Mode. Each individual write to stderr shows up as one line (even if just a few characters not ended with a newline), so make sure to do some own buffering if necessary and write out complete lines that don't need to end with a newline (but will show up as a separate line anyway). As in:

    // Output to std::cerr is unbuffered, and appears in the Console
    // window each part on a separate line. Not ideal. So collect
    // output to std::cerr into one string and write it in one go.

    std::stringstream output;
    output << THISAIRCRAFT ": The call '" << call << "' failed at line " << lineNumber;
    std::cerr << output.str() << std::flush;
1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

RoscoHead avatar image RoscoHead commented ·
No, I'm talking about on-screen, messages to the user.
0 Likes 0 ·
dga avatar image
dga answered RoscoHead commented

The "legacy" SIMCONNECT_TEXT call will feed into the Notification system.

4 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

RoscoHead avatar image RoscoHead commented ·

Thanks, I tried that, but no text was displayed. My call was:

hr = SimConnect_Text(g_hSimConnect, SIMCONNECT_TEXT_TYPE_PRINT_MAGENTA, 5, EVENT_TEXT, strlen(msg), msg);

Also, the documentation (I know it may be way behind) says:

The SimConnect_Text function is not currently available for use.

0 Likes 0 ·
virtuali avatar image virtuali RoscoHead commented ·

That's because the Simconnect_Text is tied to the flying Tips feature so, if it's disabled, you won't see anything. This is something we asked a while ago to be improved because:

If Tips are disabled, there's no way to send any feedback to the user.

The original call in FSX allowed to select a text color and, most importantly, the message duration. Right now, the text always appear as a Tip, with a fixed length of about 8 seconds, which means if something sends many calls in a short while, it will take a while to clear all the messages left in the queue. FSX could use scrolling text, MSFS can't.

And, most importantly, the SIMCONNECT_TEXT_TYPE_MENU is not supported, which is very limiting, considering it was very useful to do simple user interactions.


1 Like 1 ·
RoscoHead avatar image RoscoHead virtuali commented ·
Thanks so much for all the info, much appreciated! I do hope this "feature" improves in future.
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.