Hi
I can not seem to get GetInKey() to work. GetScancode() seems to work but not GetInKey().
This is the code I have been trying to get to work I suspect I am missing something obvious.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
textinput_buffer = ""
textinput_down = 0
textinput_In_state = 0
function textinput_init(e)
end
function textinput_main(e)
if GetScancode() ~= 0 and textinput_down == 0 then
textinput_down = 1
if textinput_In_state == 1 then
if GetScancode() == 88 then -- use F12 for now
PromptLocal(e,"->F12 unset<-")
UnFreezeAI()
UnFreezePlayer()
textinput_buffer = ""
textinput_In_state = 0
elseif GetScancode() == 28 then -- enter key
-- add buffer parser
UnFreezeAI()
UnFreezePlayer()
textinput_buffer = ""
textinput_In_state = 0
else
PromptLocal(e,"->'" .. GetInKey() .. "'=(" .. GetScancode() .. ")<-")
if GetScancode() == 14 then -- backspace
textinput_buffer = string.sub (textinput_buffer, 1, -1)
elseif GetInKey() ~= "" then
textinput_buffer = textinput_buffer .. GetInKey()
end
end
else
if GetScancode() == 88 then -- use F12 for now
PromptLocal(e,"->F12 set<-")
textinput_In_state = 1
FreezeAI()
FreezePlayer()
textinput_buffer = ""
end
end
elseif GetScancode() == 0 then
textinput_down = 0 -- reset down as key released
end
if textinput_In_state == 1 then
Panel(10,80,80,10) -- create some where to put text
Text(11,83,3,textinput_buffer)
end
end
I am using version 2017.03.10
Can someone point me to where I am going wrong or confirm GetInKey() is not working so I can raise a bug report .
Thanks in advance.
Rick.
Quod cito fit, cito perit.