February 6, 20215 yr Hi, After many years of using LINDA in a very basic sense, I've just started seeing if I can use it in a more advanced fashion, and getting involved in the dark arts of lua programming! I'm starting with the Real Air Spitfire, and have managed to trap the LVar for the air filter lever (Cowl_Air_Lever)... I've then edited the module using the LINDA editor, which tells me the syntax is OK, and the functions show up and are able to be assigned to joystick buttons. So far so good.... except it doesn't work.... Here's my initial script -- ## AirFilter ## function Carb_Air_Intake_FilterInOperation() ipc.writeLvar(Carb_Air_Lever,1) end function Carb_Air_Intake_NormalIntake() ipc.writeLvar(Carb_Air_Lever,0) end (and I've tried it with "Carb_Air_Lever" in quotes and without. the log shows [EVNT] Execute Command = "PR:044F04020:15" [EVNT] Execute Command = "PR:044F04020:17" which I think is the joystick ID and button ID, but nothing happens in the cockpit Any ideas? Intel i7 7700K @5.1Ghz, 32Gb DDR4, P3D v5.3 / MSFS running on Samsung 970evo plus Nvme SSD, Nvidia RTX2080ti Samsung 55" curved 4KHDR display, Oculus Rift CV2
February 7, 20215 yr The functions have the correct syntax. But. When starting to write any code it is worth studying examples and there are plenty in the LINDA aircraft modules. Here are a couple of recommendations to guide you: Use the Tracer to check that the Lvars work as expected. Sometimes they allow values to read and set, other times you can not set any value and you have to use a different method. The best logic structure is to first test for given value (ie. On) before applying an action (set to Off). For example function example() if readLvar(“value”) = 1 then writeLvar(“value”, 0) end end When testing a function, you can right click on the function name to run it directly. Turn on Fault Diagnosis Mode (in Maintenance) to provide better debug logging. When a button is pressed, it should be identified in the LINDA Console together with the function called. The [EVNT] statements do not give the full picture. I hope that helps. Best advice is to study and modify existing code before exploring something completely new. Edited February 7, 20215 yr by ScotFlieger Andrew Gransden Scotland, UK LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew
February 7, 20215 yr Try this syntax: ipc.writeLvar ("L:Carb_Air_Lever",1) Edited February 7, 20215 yr by Masterius
February 7, 20215 yr 16 hours ago, CharlieBravoUK said: I've then edited the module using the LINDA editor, I could be wrong and, if so, I've no doubts that wiser heads will then correct me. Be careful where you edit files. Aircraft have two files: actions.lua and user.lua. It is best to add your changes only to the user.lua file.
Archived
This topic is now archived and is closed to further replies.