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

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.