SHOW:
|
|
- or go back to the newest paste.
| 1 | channel = 16 | |
| 2 | ||
| 3 | if peripheral.getType("left")=="modem" then
| |
| 4 | modem = peripheral.wrap("left")
| |
| 5 | if modem.isWireless() then | |
| 6 | modem.open(channel) | |
| 7 | while modem.isOpen(channel) do | |
| 8 | colorTable = {}
| |
| 9 | local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
| |
| 10 | print(" ")
| |
| 11 | colorTable = message | |
| 12 | ||
| 13 | if #colorTable == 16 then | |
| 14 | nCT = 0 | |
| 15 | for i=1,#colorTable do | |
| 16 | nCT = nCT+colorTable[i] | |
| 17 | end | |
| 18 | end | |
| 19 | ||
| 20 | if nCT ~= nil then | |
| 21 | ||
| 22 | ||
| 23 | redstone.setBundledOutput("back", nCT)
| |
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | if peripheral.getType("front")=="monitor" then
| |
| 28 | m = peripheral.wrap("front")
| |
| 29 | m.setBackgroundColor(32768) | |
| 30 | m.clear() | |
| 31 | h=1 | |
| 32 | v=1 | |
| 33 | m.setCursorPos(h,v) | |
| 34 | for u=1,#colorTable do | |
| 35 | if (u+1)%2==0 then | |
| 36 | h=h+1 | |
| 37 | end | |
| 38 | if h==8 then | |
| 39 | h=2 | |
| 40 | v=v+1 | |
| 41 | end | |
| 42 | if u==9 then | |
| 43 | v=v+1 | |
| 44 | end | |
| 45 | m.setCursorPos(h,v) | |
| 46 | m.setTextColor(2^(u-1)) | |
| 47 | if colorTable[u]==0 then | |
| 48 | m.setBackgroundColor(32768) | |
| 49 | else | |
| 50 | m.setBackgroundColor(2^(u-1)) | |
| 51 | print(colorTable[u]) | |
| 52 | end | |
| 53 | m.write("=")
| |
| 54 | h=h+1 | |
| 55 | end | |
| 56 | ||
| 57 | ||
| 58 | end | |
| 59 | ||
| 60 | ||
| 61 | end | |
| 62 | ||
| 63 | end | |
| 64 | end | |
| 65 | end |