Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function menuOpt()
- local btn1 = {1,1,"Production"}
- local btn2 = {2,1,"Reactor Control"}
- local btn3 = {1,2,"Lights"}
- local btn4 = {2,2,"Check System Status"}
- local curx=btn1[1]
- local cury=btn1[2]
- while true do
- term.clear()
- term.setCursorPos(1,7)
- print("Options")
- term.setCursorPos(1,8)
- if curx==btn1[1] and cury==btn1[2] then
- print(" [",btn1[3],"] ",btn2[3]," ")
- elseif curx==btn2[1] and cury==btn2[2] then
- print(" ",btn1[3]," [",btn2[3],"]")
- else
- print(" ",btn1[3]," ",btn2[3]," ")
- end
- term.setCursorPos(1,9)
- if curx==btn3[1] and cury==btn3[2] then
- print(" [",btn3[3],"] ",btn4[3]," ")
- elseif curx==btn4[1] and cury==btn4[2] then
- print(" ",btn3[3]," [",btn4[3],"]")
- else
- print(" ",btn3[3]," ",btn4[3]," ")
- end
- e, k = os.pullEvent("key")
- if k==203 then curx = curx - 1 --left
- elseif k==205 then curx = curx + 1 --right
- elseif k==200 then cury = cury - 1 --up
- elseif k==208 then cury = cury + 1 --down
- elseif k==28 then break --enter
- end
- end
- if curx == 1 and cury == 1 then return "1" end
- if curx == 2 and cury == 1 then return "2" end
- if curx == 1 and cury == 2 then return "3" end
- if curx == 2 and cury == 2 then return "4" end
- end
- menuOpt()
Advertisement
Add Comment
Please, Sign In to add comment