Page 1 of 1

01 Using Simple Scripts to send FSX Events

Posted: 29 Nov 2011, 22:55
by Baobob
We all know that we can easily assign an FSX event to a key by selecting "Send Simconnect Event (FSX)" and picking the event we want from the dropdown box. But many of us (myself included) were a bit confused and intimidated at the thought of trying to figure out how to "Script" an event to take place. So today I want to talk a bit about the most basic "scripting" for HID macros... The "one liners" if you will...

Take the following example:

I have a hotkey linked to the TOGGLE_ALTERNATOR1 event. it looks like this...
Tutorial 1.1.jpg
Tutorial 1.1.jpg (115.99 KiB) Viewed 10587 times


But now what if I want to do the same thing using a script instead? Easy... It's a one liner... literally.. the one line is

Code: Select all

HIDMacros.FSXEvent "TOGGLE_ALTERNATOR1", 0
Which Looks like...
Tutorial 1.2.jpg
Tutorial 1.2.jpg (100.79 KiB) Viewed 10587 times


Not for the real question... Why in the world would I want to do that in the first place?
Simple... I fly multi-engine planes...

Code: Select all

HIDMacros.FSXEvent "TOGGLE_ALTERNATOR1", 0
HIDMacros.FSXEvent "TOGGLE_ALTERNATOR2", 0
HIDMacros.FSXEvent "TOGGLE_ALTERNATOR3", 0
HIDMacros.FSXEvent "TOGGLE_ALTERNATOR4", 0

Which makes it look like this...
Tutorial 1.3.jpg
Tutorial 1.3.jpg (115.31 KiB) Viewed 10587 times

Of course that is by no means the only reason for using the script rather than the "Send Simconnect Event (FSX)" dropdown box. In the same way you can send multiple events for whatever reason you like... For example the plane that I like to fly the most has it's left and right landing lights set to different switches... which for cockpit builders is a dream... but while I was still using keyboards to control the lights rather than switches, I needed the following code in order to turn them both on and off with a single keypress so I didn't overload what was already two full keyboards (not counting my regular windows keyboard).

Code: Select all

HIDMacros.FSXEvent "TOGGLE_LOGO_LIGHTS", 0
HIDMacros.FSXEvent "LANDING_LIGHTS_TOGGLE", 0


At any rate I hope this gets you started with some simple "one liner" scripting..

Re: 01 Using Simple Scripts to send FSX Events

Posted: 23 Nov 2012, 22:36
by riccardo74
Very interesting baobob, I want to do the same with NGX, but assigning CTRL+L to landing lights doesn't work.

Do you think with a specific scripts can work? Any example?

In you opinion can you interface hidmacros with LINDA or can retrive LINDA scripts that works in Hidmacros?

Many thanks,
Riccardo

Re: 01 Using Simple Scripts to send FSX Events

Posted: 22 Nov 2014, 01:02
by harry8227
Bob, thanks for the info, forgive me but I am beyond new to this. How do I get the macro into fsx to make it do its thing?