Jump to content
The simFlight Network Forums
stevem737

One Script For All Joystick Buttons Question

Recommended Posts

Hello,

I've searched the documentation, forum, and web and I'm totally lost...

I'm writing Lua scripts to control the JustFlight Vulcan add-on.  If I've got a joystick or button box with, say 50 buttons, it seems I need to do one of the following:

  1. Write 50 different Lua scripts in the Modules folder, each assigned manually from the Buttons & Switches tab to each button (which makes for a ton of files to manage); or
  2. I've read about putting a single Lua script containing all the button code into the Modules folder and configuring the FSUIPC.INI file to automatically launch it.

It seems like (2), above, is the way to go.  But, my question is how to write that Lua script to assign a joystick/button combo to a given chunk of code.

Is there an example/guidance on writing Lua code to recognize the joystick/button combo, to assign the Lua code to?  Logically, something like "For Joystick 1, Button 12 pressed, FUEL_PUMP_7=1", "For Joystick 1, Button 13 pressed, FUEL_PUMP_8=1", and so on.

Overall, I'm trying to prevent having 50+ Lua scripts, and instead, have everything in one script for easier management.  Thank you for any help.

 

 

Share this post


Link to post
Share on other sites

It would be best for you to repost your question in Pete's main support forum:

https://forum.simflight.com/forum/30-fsuipc-support-pete-dowson-modules/

This is a sub-forum about using FSUIPC with .NET programming languages.

Pete might not see your post here and I don't know enough about LUA to answer your question here.

Paul

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.