SHOW:
|
|
- or go back to the newest paste.
| 1 | rednet.open("top")
| |
| 2 | - | |
| 2 | + | local mn = peripheral.wrap("bottom")
|
| 3 | local mnb = peripheral.wrap("monitor_11")
| |
| 4 | local function clear() | |
| 5 | mn.clear() | |
| 6 | mnb.clear() | |
| 7 | end | |
| 8 | local function setTextColor(clr) | |
| 9 | mn.setTextColor(clr) | |
| 10 | - | m |
| 10 | + | mnb.setTextColor(clr) |
| 11 | end | |
| 12 | local function setCursorPos(x,y) | |
| 13 | mn.setCursorPos(x,y) | |
| 14 | - | end |
| 14 | + | mnb.setCursorPos(x,y) |
| 15 | end | |
| 16 | local function setBackgroundColor(clr) | |
| 17 | mn.setBackgroundColor(clr) | |
| 18 | mnb.setBackgroundColor(clr) | |
| 19 | end | |
| 20 | local function write(txt) | |
| 21 | mn.write(txt) | |
| 22 | mnb.write(txt) | |
| 23 | end | |
| 24 | local light = false | |
| 25 | while (true) do | |
| 26 | local senderId, message, protocol = rednet.receive() | |
| 27 | if (message == "light") then | |
| 28 | if (light == false) then | |
| 29 | light = true | |
| 30 | for i=1,sx do | |
| 31 | setCursorPos(i,2) | |
| 32 | setBackgroundColor(colors.yellow) | |
| 33 | write(" ")
| |
| 34 | end | |
| 35 | else | |
| 36 | light = false | |
| 37 | end | |
| 38 | end | |
| 39 | end |