I press Shift+E to 'open' this lua and then 1 or 2 but it does not function.
Can someone point out to me why this doesn't work?
Edit: Getting this error:
120781 KEYDOWN: VK=69, Waiting=0, Repeat=N, Shifts=1
120828 .. This key is programmed in FSUIPC4 'Keys' options
120828 LUA.2: beginning "K:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\DC6exitPickTgle.lua"
120828 *** LUA Error: ...Microsoft Games\Microsoft Flight Simulator X\Modules\DC6exitPickTgle.lua:46: unexpected symbol near 'â'
Edit2: ^^^^Figured out the above error. Its was because of the odd font characters carried over from a copy/paste of the pdf within the function of the event.key lines.
Edit3: So "DC6_Fwd_Toggle" was left in the code causing only fwd exit to work. Removed that line and now everything works. Just need to put some sort of exit Lua command after each door toggle and hopefully voila.
--Calling this Lua with Shift+E in Key Presses
--fwd below
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
DC6_ExitFwd_toggle ()
--aft below
function DC6_ExitAft_open ()
ipc.writeLvar("dc6_451_obj", 1)
ipc.display("Rear Door OPEN")
end
function DC6_ExitAft_close ()
ipc.writeLvar("dc6_451_obj", 0)
ipc.display("Rear Door CLOSED")
end
function DC6_ExitAft_toggle ()
if ipc.readLvar("dc6_451_obj") == 0 then
DC6_ExitAft_open ()
else
DC6_ExitAft_close ()
end
end
--cargo below soon
event.key(49, 8, “DC6_ExitFwd_toggle”)
event.key(50, 8, “DC6_ExitAft_toggle”)
--event.key(51, 8, “DC6_ExitCargo_toggle”)