Jump to content
The simFlight Network Forums

Lua Question


Recommended Posts

I'm just getting started with Lua scripts so please excuse my lack of knowledge. :neutral: I have read through the FSUIPC Lua Library document and noticed that virtual joystick buttons cannot be used to trigger an action such as playing a .WAV file (e.g. event.button(joynum, button, "function-name"). Is there no other way to detect a virtual joystick button to do this such as ipc.read? I have buttons for which there are no offsets so virtual buttons are my only option.

Thanks

Alan

Link to comment
Share on other sites

I'm just getting started with Lua scripts so please excuse my lack of knowledge. :neutral: I have read through the FSUIPC Lua Library document and noticed that virtual joystick buttons cannot be used to trigger an action such as playing a .WAV file (e.g. event.button(joynum, button, "function-name"). Is there no other way to detect a virtual joystick button to do this such as ipc.read? I have buttons for which there are no offsets so virtual buttons are my only option.

Joystick button trapping involves calls to Direct Input. Virtual buttons are just bits in offsets. So, just use an event.offset to detect them and trigger your function. Each byte contains 8 virtual buttons, so use "logic.And" in the function to test the relevant bit. It's no harder, rea;;y/ Just an extra line (well, plus another 'end')..

Pete

Link to comment
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...
 Share

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