Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I would like to now how can I add a delay between actions which are programmed I the same button. I could see something  about lua plugins. How could I create a .lua file?  How would I do the programming?  I have buttons and macros created

Thanks!!!

Posted
6 hours ago, dserrano said:

I would like to now how can I add a delay between actions which are programmed I the same button. I could see something  about lua plugins. How could I create a .lua file?  How would I do the programming?

The Lua sequence would simply have three parts:

First action
Delay
Second action


For example, sending controls:

ipc.control(control number, parameter) --send first control
ipc.sleep(2000) --wait for 2 seconds
ipc.control(control number, parameter) --send second control

The control numbers are listed in the List of Controls document provided (or, for FSUIPC added controls, near the end of the Advanced Users document).

There are many other things you can do instead of sending controls -- eg key presses. See the Lua library document.

Save the Lua script as a file (eg "twoactions.lua") into the FSUIPC folder. Then assign your button to Lua twoactions, which will appear in the assignments dropdown after you use the "reload" option on the button assignments option tab.

Pete


 

Posted

Hi Pete!

Thanks for your answer, today I was triyng to make a code and I did this:

1. create a LUA file (A32S_gear_dn)

2. the code:

ipc.control(66080,0)                                        -{GEAR_DOWN}-
ipc.sleep(500)
ipc.control(66066,0)                                        -{SPOILERS_ARM_ON}-
ipc.sleep(500)
ipc.macro(Macro A32S: RWY TURN OFF)     -{Macro A32S: RWY TURN OFF}-
ipc.sleep(500)
ipc.macro(Macro A32S: NOSE LIGHT)          -{Macro A32S: NOSE LIGHT}-
ipc.macro(Macro A32S: NOSE LIGHT)          -{Macro A32S: NOSE LIGHT}-
ipc.sleep(500)
ipc.macro(Macro A32S: WING LIGHT)          -{Macro A32S: WING LIGHT}-

4. Then I select the button in FSUIPC to assigned LUA A32S gear dn 

but nothing happens it doesn't work

 

kind Regards,

Diego!!!

Posted

Hi Diego,

first, try activating lua debug logging (from the FSUIPC logging options) which should help you debug any lua script.

On a first glance, your ipc.macro calls are obviously wrong - the parameter is a string and needs to be in quotes, e.g. ipc.macro("<macro file name>: <macro entry name>"), as described in the documentation.

John 

Posted

Hi John

thanks I already solved it you were right the macro were wrong I forgot the "" "".

the last question. Is it normal that after activating the button with the sequence prepar3d in the taskbar it blinks once the sequence ends?

Diego

Posted
13 hours ago, dserrano said:

Is it normal that after activating the button with the sequence prepar3d in the taskbar it blinks once the sequence ends?

I don't know, sorry. I've not noticed that here for my macros. Usually a flashing taskbar icon indicates a pending message or event in the application that requires attention, but not sure why it would flash just once.

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.