EarthMoon
The Earth and the Moon
- Joined
- Jul 12, 2022
- Messages
- 54
- Reaction score
- 38
- Points
- 18
- Location
- Germany
- Preferred Pronouns
- He, His, Him or You, Your, Yours
I am trying to code an MFD with Lua. The MFD has one button for input, but rather than opening an input box, it freezes the program forever.
The MFD is properly registered in Config\MFD\ScriptMFD.cfg and ScriptMFD is enabled in the Modules tab.
This is a slightly modified and simplified version of my original MFD code because I don't want anyone to copy my original MFD:
Short: "This function opens a dialog box, waits for input and returns the input."
But when clicking INP, Orbiter immediately freezes without even asking for input, it doesn't even highlight the INP button anymore:
The same also happened longer time ago when I was coding another MFD (cause: proc.wait_input()) so I had to remove the input function.
Why is Orbiter freezing instead of kindly asking for simple text input?
I'm using Orbiter 2016 with D3D9Client.
The MFD is properly registered in Config\MFD\ScriptMFD.cfg and ScriptMFD is enabled in the Modules tab.
This is a slightly modified and simplified version of my original MFD code because I don't want anyone to copy my original MFD:
The code uses proc.wait_input(str) to get input. According to the Help menu, it does exactly what I want:--[[
Name = NameOfMFD
Script = MFDDebug.cfg
Key = 76 ; L key
Persist = vessel
END_PARSE
--]]
vi = vessel.get_focusinterface()
function do_something() end
function func_inp()
do_something(proc.wait_input("<Input box title>:"))
end
function buttonlabel(bt)
if bt == 0 then return "INP" else return nil end
end
function buttonmenu()
return {{l1="Input", l2="<second line>",sel="i"}},2
end
function consumebutton(bt,event)
if event%PANEL_MOUSE.LBPRESSED == PANEL_MOUSE.LBDOWN and bt == 0 then
func_inp()
return true
end
return false
end
function update(skp)
mfd:set_title(skp,"<MFD Title>")
local t = "<One line of text>"
skp:text(10,30,t,#t)
end
Short: "This function opens a dialog box, waits for input and returns the input."
But when clicking INP, Orbiter immediately freezes without even asking for input, it doesn't even highlight the INP button anymore:
The same also happened longer time ago when I was coding another MFD (cause: proc.wait_input()) so I had to remove the input function.
Why is Orbiter freezing instead of kindly asking for simple text input?
I'm using Orbiter 2016 with D3D9Client.