View difference between Paste ID: 58xMS1FQ and 2tgX7X3D
SHOW: | | - or go back to the newest paste.
1-
-- This is a comment. It's for humans only. All
1+
2-
-- the green text is not run by the program
2+
3
monitor = peripheral.wrap("top")
4
monitor.clear()
5
monitor.setCursorPos(1,1)
6-
-- this creates two variables called mouseWidth
6+
7-
-- and mouseHeight and sets them to 0. We will
7+
8-
-- use them later
8+
9
monitor.setBackgroundColour((colours.lime))
10
monitor.setCursorPos(2,2)
11-
-- you need this line! It tells the computer
11+
12-
-- the monitor is on top. Change it if you want 
12+
13-
-- the monitor on a different side of the computer
13+
14
monitor.setBackgroundColour((colours.black))
15
function checkClickPosition()
16-
-- this clears the monitor screen
16+
17
    -- button one clicked
18
    rs.setOutput("right",true)
19-
-- this sets the cursor position to the top left
19+
20-
-- corner of the monitor
20+
21
    -- button two clicked
22
    rs.setOutput("right",false)
23-
-- gets the width and the height of the monitor
23+
24-
-- and stores the numbers as w and h. 
24+
25-
-- w and h are variables
25+
26
repeat 
27
event,p1,p2,p3 = os.pullEvent()
28
29-
-- prints the w and h to the computer screen.
29+
30-
-- You can see the monitor width is 7, height is 5
30+
31-
-- It starts in the top left corner like a book.  
31+
    mouseWidth = p2 -- sets mouseWidth 
32
     mouseHeight = p3 -- and mouseHeight 
33
     checkClickPosition() -- this runs our function
34-
-- Now to draw the two buttons
34+
35-
-- Im english so I write colour but you can change
35+
36-
-- it to color. It works the same.
36+
until event=="char" and p1==("x")