October 28, 20214 yr I'm as useful at coding as an eye dropper at a forest fire. I'm trying to perform a simple toggle: Toggle open/close the front door Note:the default FSX door toggle key command map does not work in this plane and I do not want to use a mouse for this Is anyone good at Lua coding FSUIPC that can help please? The LINDA code below works with a button within LINDA but I want to map a keyboard press within FSUIPC. function DC6_ExitFwd_open () ipc.writeLvar("dc6_446_obj", 1) DspShow ("Frnt", "open") end function DC6_ExitFwd_close () ipc.writeLvar("dc6_446_obj", 0) DspShow ("Frnt", "clse") end function DC6_ExitFwd_toggle () if _tl("dc6_446_obj", 0) then DC6_ExitFwd_open () else DC6_ExitFwd_close () end end Edited October 28, 20214 yr by VeryBumpy syntax
October 30, 20214 yr Author For info sake to others....after much, much research and suggestions from John Dowson, this is a working answer: function DC6_ExitFwd_open () ipc.writeLvar("dc6_446_obj", 1) ipc.display("Front door OPEN") ipc.sleep(4000) end function DC6_ExitFwd_close () ipc.writeLvar("dc6_446_obj", 0) ipc.display("Front door CLOSED") ipc.sleep(4000) end function DC6_ExitFwd_toggle () if ipc.readLvar("dc6_446_obj") == 0 then DC6_ExitFwd_open () else DC6_ExitFwd_close () end end
Archived
This topic is now archived and is closed to further replies.