Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glass = peripheral.wrap("bottom")
- rednet.open( "back" )
- -- Constants
- pos_x = 40
- pos_y = 55
- pos_inc = 10
- color["on"] = "0x2290000"
- color["off"] = "0xFF0000"
- -- Devices
- local devices = {}
- devices[1] = "Quarry"
- -- Device status
- local status = {}
- for i, device in ipairs( devices ) do
- status[device] = glass.addText( pos_x, pos_y, device, status["off"] )
- pos_y = pos_y + pos_inc
- end
- while true do
- local command = ""
- local device = ""
- local status = ""
- senderID, message, distance = rednet.receive()
- print( senderID .. ": " .. message )
- for i in string.gmatch( message, "%S+" ) do
- if not command then
- command = i
- elseif not device then
- device = i
- else
- status = i
- end
- end
- status[device].setColor( color[status] )
- end
- rednet.close( "back" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement