Jump to content

How to create custom command for CDU?


Recommended Posts

How to create custom commands for the CDU?  I want to bind my thrustmaster cougar MFD.  Using flywithlua I have the following code 

Quote

 

if PLANE_ICAO == "B733" then

DataRef("cdu1_initref" , "ixeg/733/FMC/cdu1_initref", "writable", 0)

create_command("ixeg/733/FMC/cdu1_initref", "cdu1_initref", "", "cdu1_initref = 1", "cdu1_initref = 0")

end

 

But it creates a buzzing sound as if the initref button is being constantly pressed, and doesn't seem to work.  

Please help.  

Link to post
Share on other sites
  • 5 weeks later...
On 3/10/2021 at 10:37 AM, helios123 said:

How to create custom commands for the CDU?  I want to bind my thrustmaster cougar MFD.  Using flywithlua I have the following code 

But it creates a buzzing sound as if the initref button is being constantly pressed, and doesn't seem to work.  

Please help.  

Not sure if you got this working in the meantime, but here's a possible solution:

Instead of using the DataRef function, use XPLMFindDataRef. When setting the values in your command simply use the XPLMSetDataf function.

cdu1_initref = XPLMFindDataRef("ixeg/733/FMC/cdu1_initref")

create_command("ixeg/733/FMC/cdu1_initref", "cdu1_initref", "", "XPLMSetDataf(cdu1_initref, 1)", "XPLMSetDataf(cdu1_initref, 0)")

Note that cdu1_iniref is of type float, hence why I'm using the XPLMSetDataf function, but you could also use the XPLMSetDatai function for integers. In this case it doesn't matter as all button datarefs are either 0 or 1.

Link to post
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.

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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...