Jump to content
The simFlight Network Forums
dserrano

Add delay between action in the same button

Recommended Posts

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!!!

Share this post


Link to post
Share on other sites
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


 

Share this post


Link to post
Share on other sites

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!!!

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

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