Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- selected = 1
- options = {"this","is","a","realy","cool","way","to","test","this"}
- moni = peripheral.wrap("left")
- function Draw()
- moni.clear()
- moni.setCursorPos(1,1)
- for x = 1,#options do
- if selected == x then
- mx,my = moni.getCursorPos()
- moni.write("["..options[x].."]")
- moni.setCursorPos(1,my + 1)
- else
- mx,my = moni.getCursorPos()
- moni.write(" "..options[x])
- moni.setCursorPos(1,my + 1)
- end
- end
- end
- print("The Menu is Running on the monitor")
- Draw()
- while true do
- repeat
- sleep(0)
- i = rs.getBundledInput("back")
- until i == colors.red or colors.white or colors.green
- if i == colors.white and selected > 1 then
- selected = selected - 1
- Draw()
- end
- if i == colors.red and selected < #options then
- selected = selected + 1
- Draw()
- end
- if i == colors.green then
- print("somebody selected the option: "..options[selected])
- end
- repeat
- bam = rs.getBundledInput("back")
- until bam == 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement