Posted 19 March 2012 - 07:39 PM
So, I'm having immense trouble with this menu system. Pretty simple and easy to understand, yet it will skip different things when you hit the left or right arrow key. So, for instance, if you hit < when it was on the + of * / + -, it would take you to * instead of / like it should. Any help?
local n=1
while true do
local x, y=term.getCursorPos()
term.clearLine()
if n == 1 then
write(">*< / + -")
elseif n == 2 then
write ("* >/< + -")
elseif n == 3 then
write ("* / >+< -")
elseif n == 4 then
write ("* / + >-<")
end
term.setCursorPos(x, y)
a, b=os.pullEvent()
while a~="key" do a, b=os.pullEvent()
end
if b == 203 and n == 4 then
n = 3
end
if b == 203 and n == 3 then
n = 2
end
if b == 203 and n == 2 then
n = 1
end
if b == 205 and n == 1 then
n = 2
end
if b == 205 and n == 3 then
n = 4
end
if b == 205 and n == 2 then
n = 3
end
if b == 28 then
print("") break
end
end