Gaiza Posted May 30, 2005 Share Posted May 30, 2005 Hi, i'm trying to get LoGetMCPState function to work. I' have this : table = LoGetMCPState() if table then var1 = table["CanopyOpen"] if var1 then Dosomthing() end end table is never nil, but var1 is always nil. What i'm doing wrong ? Thanks for your help. Link to comment Share on other sites More sharing options...
Brothers31 Posted May 30, 2005 Share Posted May 30, 2005 hi, try something like that. local Alarm = LoGetMCPState() for k,v in (Alarm) do if k == "CanopyOpen" then if v == true then io.write("Cannopy open:\n") else io.write("Cannopy closed:\n") end end end Not testing but it should works. Link to comment Share on other sites More sharing options...
Brothers31 Posted May 30, 2005 Share Posted May 30, 2005 ok, just testing.... and it doesn't work :icon_frow BTW i'm test with "GearFailure" and it's works.( just land at 500 KM ;) ) I thinks we have a new bug for ED. Can you comfirm ? Link to comment Share on other sites More sharing options...
Gaiza Posted May 30, 2005 Author Share Posted May 30, 2005 Thank you Brothers31. Well it's always "close", even for gear(or i'm not good to crash it), even for stall failure, autopilote.... i'v this as you shown to me : local Alarm = LoGetMCPState() for k,v in (Alarm) do if k == "StallSignalization" then if v == true then io.write("Cannopy Open:\n") else io.write("Cannopy closed:\n") end end end So i' don't know what to think... Link to comment Share on other sites More sharing options...
Gaiza Posted May 31, 2005 Author Share Posted May 31, 2005 Well, if a person from the lua dev team can confirm that this function work. Because i need this for the programme i'm curently devlpoping. It's a generic interface for cockpit builders.But if this function is'nt working for now, i'll wait... Thanks. Link to comment Share on other sites More sharing options...
Gaiza Posted May 31, 2005 Author Share Posted May 31, 2005 Hello, finally i get some values to work : i use this script : local Alarm = LoGetMCPState() for k,v in (Alarm) do if k == "LeftEngineFailure" then if v == true then io.write("LeftEngineFailure On:\n") else io.write("LeftEngineFailure Off:\n") end end if k == "RightEngineFailure" then if v == true then io.write("RightEngineFailure On:\n") else io.write("RightEngineFailure Off:\n") end end if k == "HydraulicsFailure" then if v == true then io.write("HydraulicsFailure On:\n") else io.write("HydraulicsFailure Off:\n") end end if k == "ACSFailure" then if v == true then io.write("ACSFailure On:\n") else io.write("ACSFailure Off:\n") end end if k == "AutopilotFailure" then if v == true then io.write("AutopilotFailure On:\n") else io.write("AutopilotFailure Off:\n") end end if k == "AutopilotOn" then if v == true then io.write("AutopilotOn On:\n") else io.write("AutopilotOn Off:\n") end end if k == "MasterWarning" then if v == true then io.write("MasterWarning On:\n") else io.write("MasterWarning Off:\n") end end if k == "LeftTailPlaneFailure" then if v == true then io.write("LeftTailPlaneFailure On:\n") else io.write("LeftTailPlaneFailure Off:\n") end end if k == "RightTailPlaneFailure" then if v == true then io.write("RightTailPlaneFailure On:\n") else io.write("RightTailPlaneFailure Off:\n") end end if k == "LeftAileronFailure" then if v == true then io.write("LeftAileronFailure On:\n") else io.write("LeftAileronFailure Off:\n") end end if k == "RightAileronFailure" then if v == true then io.write("RightAileronFailure On:\n") else io.write("RightAileronFailure Off:\n") end end if k == "CanopyOpen" then if v == true then io.write("CanopyOpen On:\n") else io.write("CanopyOpen Off:\n") end end if k == "CannonFailure" then if v == true then io.write("CannonFailure On:\n") else io.write("CannonFailure Off:\n") end end if k == "StallSignalization" then if v == true then io.write("StallSignalization On:\n") else io.write("StallSignalization Off:\n") end end if k == "LeftMainPumpFailure" then if v == true then io.write("LeftMainPumpFailure On:\n") else io.write("LeftMainPumpFailure Off:\n") end end if k == "RightMainPumpFailure" then if v == true then io.write("RightMainPumpFailure On:\n") else io.write("RightMainPumpFailure Off:\n") end end if k == "LeftWingPumpFailure" then if v == true then io.write("LeftWingPumpFailure On:\n") else io.write("LeftWingPumpFailure Off:\n") end end if k == "RightWingPumpFailure" then if v == true then io.write("RightWingPumpFailure On:\n") else io.write("RightWingPumpFailure Off:\n") end end if k == "RadarFailure" then if v == true then io.write("RadarFailure On:\n") else io.write("RadarFailure Off:\n") end end if k == "EOSFailure" then if v == true then io.write("EOSFailure On:\n") else io.write("EOSFailure Off:\n") end end if k == "MLWSFailure" then if v == true then io.write("MLWSFailure On:\n") else io.write("MLWSFailure Off:\n") end end if k == "RWSFailure" then if v == true then io.write("RWSFailure On:\n") else io.write("RWSFailure Off:\n") end end if k == "ECMFailure" then if v == true then io.write("ECMFailure On:\n") else io.write("ECMFailure Off:\n") end end if k == "GearFailure" then if v == true then io.write("GearFailure On:\n") else io.write("GearFailure Off:\n") end end if k == "MFDFailure" then if v == true then io.write("MFDFailure On:\n") else io.write("MFDFailure Off:\n") end end if k == "HUDFailure" then if v == true then io.write("HUDFailure On:\n") else io.write("HUDFailure Off:\n") end end if k == "HelmetFailure" then if v == true then io.write("HelmetFailure On:\n") else io.write("HelmetFailure Off:\n") end end if k == "FuelTankDamage" then if v == true then io.write("FuelTankDamage On:\n") else io.write("FuelTankDamage Off:\n") end end many values are ok but some still missing. i'll check each of them,and let you know.... Link to comment Share on other sites More sharing options...
Brothers31 Posted May 31, 2005 Share Posted May 31, 2005 Hello, finally i get some values to work : i use this script : local Alarm = LoGetMCPState() for k,v in (Alarm) do if k == "LeftEngineFailure" then if v == true then io.write("LeftEngineFailure On:\n") else io.write("LeftEngineFailure Off:\n") end end if k == "RightEngineFailure" then if v == true then io.write("RightEngineFailure On:\n") else io.write("RightEngineFailure Off:\n") end end if k == "HydraulicsFailure" then if v == true then io.write("HydraulicsFailure On:\n") else io.write("HydraulicsFailure Off:\n") end end if k == "ACSFailure" then if v == true then io.write("ACSFailure On:\n") else io.write("ACSFailure Off:\n") end end if k == "AutopilotFailure" then if v == true then io.write("AutopilotFailure On:\n") else io.write("AutopilotFailure Off:\n") end end if k == "AutopilotOn" then if v == true then io.write("AutopilotOn On:\n") else io.write("AutopilotOn Off:\n") end end if k == "MasterWarning" then if v == true then io.write("MasterWarning On:\n") else io.write("MasterWarning Off:\n") end end if k == "LeftTailPlaneFailure" then if v == true then io.write("LeftTailPlaneFailure On:\n") else io.write("LeftTailPlaneFailure Off:\n") end end if k == "RightTailPlaneFailure" then if v == true then io.write("RightTailPlaneFailure On:\n") else io.write("RightTailPlaneFailure Off:\n") end end if k == "LeftAileronFailure" then if v == true then io.write("LeftAileronFailure On:\n") else io.write("LeftAileronFailure Off:\n") end end if k == "RightAileronFailure" then if v == true then io.write("RightAileronFailure On:\n") else io.write("RightAileronFailure Off:\n") end end if k == "CanopyOpen" then if v == true then io.write("CanopyOpen On:\n") else io.write("CanopyOpen Off:\n") end end if k == "CannonFailure" then if v == true then io.write("CannonFailure On:\n") else io.write("CannonFailure Off:\n") end end if k == "StallSignalization" then if v == true then io.write("StallSignalization On:\n") else io.write("StallSignalization Off:\n") end end if k == "LeftMainPumpFailure" then if v == true then io.write("LeftMainPumpFailure On:\n") else io.write("LeftMainPumpFailure Off:\n") end end if k == "RightMainPumpFailure" then if v == true then io.write("RightMainPumpFailure On:\n") else io.write("RightMainPumpFailure Off:\n") end end if k == "LeftWingPumpFailure" then if v == true then io.write("LeftWingPumpFailure On:\n") else io.write("LeftWingPumpFailure Off:\n") end end if k == "RightWingPumpFailure" then if v == true then io.write("RightWingPumpFailure On:\n") else io.write("RightWingPumpFailure Off:\n") end end if k == "RadarFailure" then if v == true then io.write("RadarFailure On:\n") else io.write("RadarFailure Off:\n") end end if k == "EOSFailure" then if v == true then io.write("EOSFailure On:\n") else io.write("EOSFailure Off:\n") end end if k == "MLWSFailure" then if v == true then io.write("MLWSFailure On:\n") else io.write("MLWSFailure Off:\n") end end if k == "RWSFailure" then if v == true then io.write("RWSFailure On:\n") else io.write("RWSFailure Off:\n") end end if k == "ECMFailure" then if v == true then io.write("ECMFailure On:\n") else io.write("ECMFailure Off:\n") end end if k == "GearFailure" then if v == true then io.write("GearFailure On:\n") else io.write("GearFailure Off:\n") end end if k == "MFDFailure" then if v == true then io.write("MFDFailure On:\n") else io.write("MFDFailure Off:\n") end end if k == "HUDFailure" then if v == true then io.write("HUDFailure On:\n") else io.write("HUDFailure Off:\n") end end if k == "HelmetFailure" then if v == true then io.write("HelmetFailure On:\n") else io.write("HelmetFailure Off:\n") end end if k == "FuelTankDamage" then if v == true then io.write("FuelTankDamage On:\n") else io.write("FuelTankDamage Off:\n") end end many values are ok but some still missing. i'll check each of them,and let you know.... :icon_wink Coolllll Link to comment Share on other sites More sharing options...
Fluke Posted October 10, 2012 Share Posted October 10, 2012 Hello All local Alarm = LoGetMCPState() for k,v in (Alarm) do if k=="MasterWarning" then if v==true then io.Write("MasterWarning") end end end I used this code but every time give error message: Lua::Config::call error LuaExportAfterNextFrame:./Config/Export/Export.lua:56: attempt to call a table value Line 56 is a FOR loop Link to comment Share on other sites More sharing options...
Speed Posted October 11, 2012 Share Posted October 11, 2012 Hello All local Alarm = LoGetMCPState() for k,v in (Alarm) do if k=="MasterWarning" then if v==true then io.Write("MasterWarning") end end end I used this code but every time give error message: Lua::Config::call error LuaExportAfterNextFrame:./Config/Export/Export.lua:56: attempt to call a table value Line 56 is a FOR loop You forgot to use the pairs table iterator function. Your for loop should start like I have it below. Note the bolded function. ... for k, v in pairs(Alarm) do ... 1 Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc. Link to comment Share on other sites More sharing options...
Fluke Posted October 12, 2012 Share Posted October 12, 2012 Thank you Speed. This now working correctly. Link to comment Share on other sites More sharing options...
hannibal Posted October 16, 2022 Share Posted October 16, 2022 DCS World 2.7 does these functions still work? find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
Recommended Posts