helios123 Posted March 10, 2021 Report Posted March 10, 2021 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. Quote
jfjoubert Posted April 9, 2021 Report Posted April 9, 2021 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.