Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local choices = {
- {"Farm",false,colors.orange},
- {"Walrus",false,colors.green}
- {"Bees",false,colors.red}
- }
- local choice = 0
- local base = {true, colors.white}
- local size = #choices;
- function update()
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- for i=1,size do
- if choices[i][2] then
- mon.setTextColor(colors.green)
- else
- mon.setTextColor(colors.red)
- end
- mon.setCursorPos(1,i)
- mon.write(choices[i][1])
- end
- signal()
- end
- function signal()
- local output = 0
- for i=1,size do
- if choices[i][2] then
- output = choices[i][3]
- end
- end
- if choice == 0 then
- redstone.setBundledOutput("right",0)
- else
- redstone.setBundledOutput("right",colors.white + output)
- end
- end
- mon = peripheral.wrap("back")
- update()
- while true do
- event, p1, x, y= os.pullEvent()
- if event == "monitor_touch" then
- if y <= size then
- for i = 1,size do
- choices[i][2] = false
- end
- choices[y][2] = true
- choice = choices[y][3]
- update()
- end
- elseif event == "redstone" then
- if rs.getBundledInput("right") == colors.white+colors.black+choice then
- for i = 1,size do
- choices[i][2] = false
- end
- choice = 0
- update()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment