Airbuspilot Posted October 17 Report Posted October 17 Please allow me to ask another Question regarding lua Scripting. In my Script i want to determine, which Key on the Keyboard is pressed. Let's say for the Keyboard Letter S. I want to do the Following. If Key S is pressed then Do something else If Key S is released then Do something else end end I know about the Key Assignments in the FSUIPC Menu. But i need to do some individual Things when a Key is pressed or released. Is it possible, to handle the Keypresses in a lua Script? I know, that i can simulate Keypresses with the ipc.keypress Command. But i need to read, which Key is pressed. Is there a similar Command available to do this Task? Thanks in Advance for your Help. Joachim
John Dowson Posted October 17 Report Posted October 17 You don't do things like that really... There are two choices: - capture the key press/release event using event.key. The lua script needs to be running to do this - such scripts are usually auto-started, - have two lua scripts, and assign one to be called/ran on the key press, and the other to be ran on the key release Using events is the preferred method and will be quicker than having two separate scripts,
Airbuspilot Posted Monday at 05:56 PM Author Report Posted Monday at 05:56 PM Thanks for the Reply and the useful Informations.
kaha Posted Tuesday at 09:25 AM Report Posted Tuesday at 09:25 AM If you really want to read a button state you can do it like this: Button_C_Mask = ipc.buttons("C") if logic.And(Button_C_Mask, 0x8000000) == 0x8000000 then Karl
John Dowson Posted Tuesday at 11:22 AM Report Posted Tuesday at 11:22 AM 1 hour ago, kaha said: If you really want to read a button state you can do it like this: Button_C_Mask = ipc.buttons("C") if logic.And(Button_C_Mask, 0x8000000) == 0x8000000 then Its the state of a key he wants to read, not a button.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now