Jump to content
The simFlight Network Forums

event.button(joy, btn,"button_fcn") question.


Recommended Posts

Posted

When using event.button(joy, btn,"button_fcn") if the button_fcn function is running due to a button press when a second button press occurs, is the currently running button_fcn immediately killed and a new instance of button_fcn initiated?

Thanks,

Al

Posted
4 hours ago, John Dowson said:

No, the function will complete,

OK, then if a second button push happens while the function in response to the first button push is running, is that second button push "missed" or will the button function be called again as soon as it completes due to the first button push?

UPDATE:  Looks like the second button press is not missed and the button function will be called again.

Thanks,

Al

Posted

Not 100% sure, but it will probably be missed, but this depends when the event flag on the button press is cleared - either when the function is called (in which case the 2nd button press will be registered) or when the function is finished (in which case it will be missed). I think its the latter, but should be easy to write a simple test lua to clarify if needed.

Anyway, the function should really finish before the second button press, and you can also use button repeats.

John

Posted
6 hours ago, John Dowson said:

Anyway, the function should really finish before the second button press, and you can also use button repeats.

I was thinking about the triple function button script that detects a second button press.

Al

Posted
5 hours ago, John Dowson said:

Do you have any issues with that script?

No, was just thinking the script does respond to a double button press so the second press is not missed. I guess the issue is does the buttonpress function due to the first press complete before the second press happens. If not, then it would seem the button presses are "registered" as you called it.

Al

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.