MENU:
(Start) Reboot Exit
Something like that.I do also proboly want to know how to make it when you click enter,it will do something.
Any answers?Thanks if you do
Posted 24 December 2012 - 08:39 AM
Posted 24 December 2012 - 08:58 AM
t_menuOptions = {"Start", "Reboot", "Exit"}
function menu(menuOptions)
local selected = 1
local offX,offY = term.getCursorPos()
local curX,curY = term.getCursorPos()
while true do
if selected > #menuOptions then selected = 1 end
if selected < 1 then selected = #menuOptions end
for i = 1, #menuOptions do
if selected == i then
write("("..menuOptions[i]..")")
else
write(" "..menuOptions[i].." ")
end
end
while true do
local e,e1 = os.pullEvent("key")
-- Left
if e1 == 203 then
selected = selected - 1
term.setCursorPos(curX,curY)
break
end
-- Right
if e1 == 205 then
selected = selected+1
term.setCursorPos(curX,curY)
break
end
-- Right
if e1 == 28 then
term.setCursorPos(curX,curY)
return menuOptions[selected]
end
end
end
end
option = menu(t_menuOptions)
if option == t_menuOptions[1] then
-- Start
elseif option == t_menuOptions[2] then
-- Reboot
os.reboot()
elseif option == t_menuOptions[3] then
-- Exit
end
Posted 24 December 2012 - 09:02 AM
Posted 09 January 2013 - 12:53 PM
Posted 09 January 2013 - 06:33 PM
0 members, 3 guests, 0 anonymous users