Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screen = peripheral.wrap("right")
- local monX, monY = screen.getSize()
- local title = "Touch Menu"
- local mnui1 = "Bread"
- local mnui2 = "Hotdog"
- function ServeMenu()
- screen.clear()
- screen.setCursorPos(1,1)
- screen.write(title)
- screen.setCursorPos(1,2)
- screen.write("----------")
- screen.setCursorPos(3,3)
- screen.write(mnui1)
- screen.setCursorPos(1,4)
- screen.write("----------")
- screen.setCursorPos(12, 2)
- screen.write("----------")
- screen.setCursorPos(14, 3)
- screen.write(mnui2)
- screen.setCursorPos(12, 4)
- screen.write("----------")
- local event, side, x, y = os.pullEvent("monitor_touch")
- if event then
- screen.clear()
- screen.setCursorPos(1,1)
- if y == 2 then
- if x >= 1 and x < 10 then
- screen.write("Bread touched")
- sleep(2)
- elseif x >= 11 and x < 20 then
- screen.write("Hotdog touched")
- sleep(2)
- end
- end
- end
- ServeMenu()
- end
- ServeMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement