Yeah, it ended up only taking 6 lines of script, it just took me a really long time to figure out what the 6 lines were. In case anyone else is using this instrument, here's what I had to do to make it work with a rotary encoder.
--Create 3 macros. The first line of the macro is the x,y coordinates of where the button is on the screen. You'll have to experiment to find the values for your sim. The final digit on the first line is telling the sim to use FS window relative coordinates. The digit on the 2nd line tells the sim which mouse button is being pressed. 0 for left, 1 for middle, and 2 for right. Make sure the 3 macros are saved in your MODULES folder.
Macro 1, save as 'G5right.lua': mouse.move(-1965, 403, 1)
mouse.click(2)
Macro 2, save as 'G5left.lua': mouse.move(-1965, 403, 1)
mouse.click(0)
Macro 3, save as 'G5button.lua': mouse.move(-1965, 403, 1)
mouse.click(1)
--Set up 1 input on Mobiflight for the button part of the encoder, and 1 input for the rotary part of the encoder. (You know how to do that and assign the pins from the Arduino, right?)
--On the button input settings, set the 'on press' action type to 'lua macro', the macro name as 'lua g5button', and the value as '0'.
--On the encoder input settings, set the 'on left' action type to 'lua macro', the macro name as 'lua g5left', and the value as '0'. Set the 'on right' action type to 'lua macro', the macro name as 'lua g5right', and the value as '0'.
The G5 gauge the Mr. Kellog wrote (and made available for free) is a really great addition to a GA sim. Being able to use Mobiflight and a rotary encoder makes it even better.