Jump to content
The simFlight Network Forums

LUA function as macro?


Recommended Posts

Hello!

I've writing a lua-code that allows me to assign some the MADDOG 2008 buttons and switches to my controls.


-- RUD HYD CONT (OFF)
if ipcPARAM == 1 then
ipc.control(69775, 0)
end[/font]
[font=arial,helvetica,sans-serif]-- RUD HYD CONT (RUD)
if ipcPARAM == 2 then
ipc.control(69775, 1)
end[/font]
[font=arial,helvetica,sans-serif]-- FUEL XFEED (OFF)
if ipcPARAM == 3 then
ipc.control(69776, 0)
end
[/CODE]

[/font]

[font=arial,helvetica,sans-serif]However, having to assign the different commands by entering a parameter isn't very time efficient as I have to look up what a particular number does.[/font]

[font=arial,helvetica,sans-serif]Hence, I'm wondering how I would make a LUA function show up in the control list like a macro would?[/font]

[font=arial,helvetica,sans-serif]PS, I'm aware that I haven't defined any functions in that code![/font]

Link to comment
Share on other sites

However, having to assign the different commands by entering a parameter isn't very time efficient as I have to look up what a particular number does.

Hence, I'm wondering how I would make a LUA function show up in the control list like a macro would?

Only by splitting that Lua program up into separate ones for each function. Then you'd see "lua XXX" for function XXX and so on.

But if all you are doing is sending control numbers why no do it by simple assignment in the [buttons] section of the INI? Yjr control numbers, like 69775 and so on, are the numbers which follow the "C" in lines like

1=P1,1,C65602,0

The parameter there is the 0.

Pete

Link to comment
Share on other sites

Thank you for your inputs pete. The reason why I haven't assigned the functions in the ini-file is that sometimes when I clean my PC inside the chassi, or when I add a component to it, I have to recalibrate everything in FSUIPC as my computer mix up the controls. Assigning the functions by editing text would give me even more to take care of in those events.

Assigning the events in the ini-file, would be a perfect solution if there's a way to prevent the mentioned problem from occuring at all.

Johan

Edited by johnor999
Link to comment
Share on other sites

Thank you for your inputs pete. The reason why I haven't assigned the functions in the ini-file is that sometimes when I clean my PC inside the chassi, or when I add a component to it, I have to recalibrate everything in FSUIPC as my computer mix up the controls.

If you mean that the ID's of the joysticks change, then you should investigate the facilities in FSUIPC for letters assigned to those joytsticks. FSUIPC then keeps track of any changes. There's a chapter in the user guide dedicated to this -- search for "letters".

Assigning the functions by editing text would give me even more to take care of in those events.

Bearing in mind we are only talking about button or key asignments, there's no reason at all for those to ever change if you used Joy Letters as just mentioned.

Regards

Pete

Link to comment
Share on other sites

I took your advice on the matter, thanks a lot for your help!

Maybe the ability to assign joy controls to FS controls via the button/axis assignment tabs? Something similar to the way one would assign FSUIPC offsets perhaps?

Johan

Link to comment
Share on other sites

Maybe the ability to assign joy controls to FS controls via the button/axis assignment tabs? Something similar to the way one would assign FSUIPC offsets perhaps?

Er, sorry. I don't understand what you are asking. FSUIPC already offers the ability to assign FS and FSUIPC controls to axes or buttons in those tabs. That's the whole point of them -- offset actions are merely a small part of the complete list of controls which can be assigned! Have you never visited the assignments tabs and seen the drop-down list of controls? :-(

Pete

Link to comment
Share on other sites

I've used those functions A LOT, however non-default fs controls aren't available there (I do understand why though). For example, MADDOG 2010 utilizes these non-default controls for basically every switch in the cockpit. There are probably other addons that do this as well.

Johan

Link to comment
Share on other sites

I've used those functions A LOT, however non-default fs controls aren't available there (I do understand why though). For example, MADDOG 2010 utilizes these non-default controls for basically every switch in the cockpit. There are probably other addons that do this as well.

What do you mean by "non-default functions"? If you mean L:Vars and mouse macros et cetera, there's no way I'm going to try and catalogue all of the possible ones for add-ons and list them all. Sorry.

Regards

Pete

Link to comment
Share on other sites

Okay, I'm refering to the FS Controls 6XXXX. Now some addons uses 6XXXX controls (I found them through LINDA) that aren't available in the documentation that you provided. I'm not asking if you could include those as options as I know how much you would have to do to make it happen. What I'm asking about is if you could add the option to select the item "Custom Control" in the lists that you provide in your buttons, key and axis assignments tabs. What this would do, is to enable one to enter the 6XXXX control and an assigned parameter. (Kind of like the offset functions that you have already provided)

For clarity, I'm refering to the controls mentioned in List of FSX controls.pdf

An example: in MADDOG 2010, offset 69838 param 16777216, turns on the left fuel heat.

Since 69XXX is a custom control, it could be assigned by the user through the suggested function. This means that I would just scroll down the control list and select "Custom Control" and then type in "69838" as the offset and "16777216" as its parameter.

Johan

Link to comment
Share on other sites

Okay, I'm refering to the FS Controls 6XXXX. Now some addons uses 6XXXX controls (I found them through LINDA) that aren't available in the documentation that you provided. I'm not asking if you could include those as options as I know how much you would have to do to make it happen.

Oh, you mean the use of otherwise unused FS control numbers for other things specific to different add-ons. Actually I was unaware that anything did that until recently when logging events on the PMDG 737NGX.

Obviously, even if we knew what some of them did (and of course the 737NGX ones are now documented in their SDK), it wouldn't be possible to name all those correctly in assignment drop-downs, because they could be used differently by all the add-ons that possibly exist now and in the future.

What I'm asking about is if you could add the option to select the item "Custom Control" in the lists that you provide in your buttons, key and axis assignments tabs. What this would do, is to enable one to enter the 6XXXX control and an assigned parameter. (Kind of like the offset functions that you have already provided)

For clarity, I'm refering to the controls mentioned in List of FSX controls.pdf

Well of course all of those listed in that document are already listed by those same names in the drop down, so I must assume you mean those not so listed, lke those in the PMDG NGX well outside the range of numbers used in FSX. If you don't actually mean that, then I still don't understand.

Basically, you are asking for a short cut to avoid editing those numbers, the ones used by add-ons only, in the FSUIPC INI?

An example: in MADDOG 2010, offset 69838 param 16777216, turns on the left fuel heat.

Since 69XXX is a custom control, it could be assigned by the user through the suggested function. This means that I would just scroll down the control list and select "Custom Control" and then type in "69838" as the offset and "16777216" as its parameter.

I honestly hadn't realised anything other than the PMDG 737NGX used this method.

I will certainly consider a way of doing what you ask in a future release. Meanwhile it can of course be done via INI editing.

Regards

Pete

Link to comment
Share on other sites

I will certainly consider a way of doing what you ask in a future release. Meanwhile it can of course be done via INI editing.

Okay. Version 4.821, available now in the Download Links subforum, contains facilities in the Buttons, Keys and Axis assignment option tabs to assign "custom controls", being FS controls in the range 65536 to 131070.

I'll make the same facilities available in FSUIPC3 is due course.

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.