Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hey John,

is it possible, to simulate a Press of a Joystick with Lua Code?
I want to simulate this Button Press if a special Condition is fulfilled.

Thanks in Advance
Joachim

Posted
  On 11/1/2023 at 6:53 PM, Airbuspilot said:

is it possible, to simulate a Press of a Joystick with Lua Code?
I want to simulate this Button Press if a special Condition is fulfilled.

Expand  

In general yes (see the FSUIPC Lua Event library), but it depends on if the special condition can be detected with code; that is, are the necessary simvars (variables) associated with the special condition available?  I think it would help John give you the best answer if you would provide him with some information on the nature of the special condition you are talking about.

Al

Posted
  On 11/1/2023 at 6:53 PM, Airbuspilot said:

is it possible, to simulate a Press of a Joystick with Lua Code?

Expand  

Generally not, only for virtual buttons - see the ipc.btnPress, ipc.btnRelease and ipc.btnToggle lua functions.

But why do you want to do this? Can you not just simulate the action that the button press performs when your condition is met, rather than the button press itself?

John

Posted
  On 11/2/2023 at 12:02 AM, ark1320 said:

In general yes (see the FSUIPC Lua Event library), but it depends on if the special condition can be detected with code; that is, are the necessary simvars (variables) associated with the special condition available?  I think it would help John give you the best answer if you would provide him with some information on the nature of the special condition you are talking about.

Expand  

I have several Planes, that were controlled and directed by a File named FlightLog.lua
For every Plane there is a separate File, that contains the SimVars and Lvars of this Plane. This File is also named FlightLog but extended with the ID of this Aircraft, i.E. FlightLog.DAIJB
The Reason for this is to save my Flights in a MS Access Database. Before starting a Flight, i file FlightPlans, Fuel Amounts, PayLoad, etc. in this DB. Once everything is done, i rename
the File FlightLog.DAIJB to FlightLog.lua and copy it from the Scripts Folder to the FSUIPC Folder. Because of that, i have all Variables according to the used Plane in the FlightLog.lua and 
can assure, that the Variables are available at the Runtime. For each of this Aircraft there are different Variables, that will be used, to trigger the Condition where the simulated Joystick Button should be pressed.  

Posted
  On 11/2/2023 at 8:36 AM, John Dowson said:

Generally not, only for virtual buttons - see the ipc.btnPress, ipc.btnRelease and ipc.btnToggle lua functions.

But why do you want to do this? Can you not just simulate the action that the button press performs when your condition is met, rather than the button press itself?

Expand  

In general i could do that. But for each A/C i have a different FlightLog.lua and an according Window.lua
I start them with one Joystick Button on the Press and Release Event. My Aim is now, to open a second Window if necessary for the used Plane.
This could be named Window2.lua and could be assigned to a separate Joystick Button in the FSUIPC Button Assignments. And so i want to simulate
the Button Press with Lua Code, if my Condition is fulfilled. I want to do it this Way to hold the FlightLog itself as small as possible for Maintenance Reasons.
I know, i could fill all the Window Texts in the FlightLog, but i would prefer the separate File Solution for each Window.lua, if possible

Joachim 

Posted
  On 11/2/2023 at 8:48 AM, Airbuspilot said:

This could be named Window2.lua and could be assigned to a separate Joystick Button in the FSUIPC Button Assignments. And so i want to simulate
the Button Press with Lua Code, if my Condition is fulfilled.

Expand  

If your condition is filled, you can just call ipc.runlua("Window2.lua"), no?

Otherwise, use virtual buttons which can be "simulated".

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
×
×
  • Create New...

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.