Jump to content
The simFlight Network Forums

Lua Script


Recommended Posts

Hi All,

I am trying to write a LUA script to to use Joy inputs to control the volume on my Mustangs audio panel in FSX. Here is the snippet of code from the xml


<MouseArea id="VolumeControl">
<FloatPosition>34.000,794.000</FloatPosition>
<Size>113,104</Size>
- <MouseArea id="VolumeDecrease">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>56,104</Size>
<CursorType>DownArrow</CursorType>
- <MouseClick id="MouseClick">
<Script>9 (>K:THROTTLE4_SET)</Script>
<ClickType>LeftSingle</ClickType>
</MouseClick>
- <Tooltip id="Tooltip">
<DefaultScript>Music Volume Decrease (%((L:fuckyoaudio,numbers))%!d!%%)</DefaultScript>
[/CODE]

Since this writes to K: and not an L: i'm not sure how to do it.

<Script>9 (>K:THROTTLE4_SET)</Script> will decrease and

<Script>8 (>K:THROTTLE4_SET)</Script> will Increase it

Can LUA send this command? Mouse Macro couldn't do it. Maybe use the Mouse ID area shown above in the code? Not sure if it works that way.

Thanks,

Rob

Link to comment
Share on other sites

Since this writes to K: and not an L: i'm not sure how to do it.

<Script>9 (>K:THROTTLE4_SET)</Script> will decrease and

<Script>8 (>K:THROTTLE4_SET)</Script> will Increase it

Throttle4 Set is a normal FS control, the "K" stands for "Key Event" (the internal names for FS controls start "KEY_...". I think this dates back to when they were only keyboard controls).

So, just send it using ipc.control(<number>, <parameter>). The parameters will be the 9 or 8 and you'll find the control numbers in the List of Controls in the FSUIPC Doecuments folder. Alternatively, instead of using Lua, you could simply assign direct to Throttle4 set in the FSUIPC Buttons and Switches option tab.

Regards

Pete

Link to comment
Share on other sites

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.