Jump to content

Recommended Posts

Posted

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.  

  • 5 weeks later...
Posted
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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...