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 dga edited

Sending sim events from toolbar panel

Is it possible to send sim events from JS code in a toolbar panel? Some things (eg: setting sim rate) cannot be done by changing sim vars. Any help much appreciated!

html
10 |10000 characters needed characters left characters exceeded

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

dga avatar image
dga answered dga edited

Adding

<script type="text/javascript" src="/JS/simvar.js"></script>

Should allow you to send the K events for SimRate increase and decrease like

SimVar.SetSimVarValue("K:SIM_RATE_INCR", "number", 0);
SimVar.SetSimVarValue("K:SIM_RATE_DECR", "number", 0);

p.s. the value doesn't matter, because the k event takes no parameter afaik

2 comments
10 |10000 characters needed characters left characters exceeded

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

Thanks! Sorry for such a newbie question, but is there a list of these K events? And are there other letters?
0 Likes 0 ·
virtuali avatar image
virtuali answered virtuali edited

Does that works for custom events too ? Provided we have a client that responds to custom events via Simconnect, will something like this work ?


SimVar.SetSimVarValue("K:Custom.Event", "number", 0);
10 |10000 characters needed characters left characters exceeded

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

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 4.8 MiB each and 23.8 MiB total.