View difference between Paste ID: zDP2f5t9 and kWGzRH1u
SHOW: | | - or go back to the newest paste.
1
local screen = peripheral.wrap("right")
2
local monX, monY = screen.getSize()
3
local title = "Touch Menu"
4
local mnui1 = "Bread"
5
local mnui2 = "Hotdog"
6
7
function ServeMenu()
8
    screen.clear()
9
    screen.setCursorPos(1,1)
10
    screen.write(title)
11
    
12
    screen.setCursorPos(1,2)
13
    screen.write("----------")
14
    screen.setCursorPos(3,3)
15
    screen.write(mnui1)
16
    screen.setCursorPos(1,4)
17
    screen.write("----------")
18
    
19
    screen.setCursorPos(12, 2)    
20
    screen.write("----------")
21
    screen.setCursorPos(14, 3)
22
    screen.write(mnui2)
23
    screen.setCursorPos(12, 4)
24
    screen.write("----------")
25
    
26
    local event, side, x, y = os.pullEvent("monitor_touch")
27
    
28
    if event then
29
        screen.clear()
30
        screen.setCursorPos(1,1)
31
        if y == 2 then
32
            if     x >= 1 and x < 10 then
33
                screen.write("Bread touched")
34
                sleep(2)
35
            elseif x >= 11 and x < 20 then
36
                screen.write("Hotdog touched")
37
                sleep(2)
38
            end            
39
        end        
40
    end
41
    
42
    ServeMenu()
43
end
44
45
ServeMenu()
46