Posted 06 August 2012 - 06:54 AM
I am currently trying to make a OS with a GUI, but when I try and launch the program it doesn't seem to let the arrows work (Left and Right arrows). I have made sure I had the arrows configured. Another error I noticed is a bug where when I launch the program It doesn't work until I press a key.
I have not added the functions for the options yet.
Here is the code:
I have not added the functions for the options yet.
Here is the code:
--No Terminate
os.pullEvent = os.pullEventRaw
--Rednet
rednet.open("top")
rednet.open("bottom")
rednet.open("left")
rednet.open("right")
rednet.open("front")
rednet.open("back")
--
--GUI
local option = {}
option[1] = "[Login] Register Exit"
option[2] = " Login [Register] Exit"
option[3] = " Login Register [Exit]"
--Login Function
function login()
end
--Register Function
function register()
end
--Exit Function
function exit()
end
--Goto Function
function gotoMenu(i)
if i == 1 then
login()
elseif i == 2 then
register()
elseif i == 3 then
exit()
end
end
--Option Function
function options(i)
if not i then
i = 1
end
term.clear()
term.setCursorPos(1,1)
print(option[i])
event, key = os.pullEvent("key")
while true do
if key == 203 and not i == 1 then
return options(i - 1)
elseif key == 205 and not i == 3 then
return options(i + 1)
elseif key == 28 then
return gotoMenu(i)
end
end
end
options()