Advertisement
Clorith

Untitled

Sep 29th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. glass = peripheral.wrap("bottom")
  2.  
  3. rednet.open( "back" )
  4.  
  5. -- Constants
  6. pos_x = 40
  7. pos_y = 55
  8. pos_inc = 10
  9. color[on] = "0x2290000"
  10. color[off] = "0xFF0000"
  11.  
  12. -- Devices
  13. local devices = {Quarry}
  14.  
  15. -- Device status
  16. local status = {}
  17. for i, device in ipairs( devices ) do
  18.   status[device] = glass.addText( pos_x, pos_y, device, status[off] )
  19.   pos_y = pos_y + pos_inc
  20. end
  21.  
  22. statusQuarry = glass.addText( 40, 55, "Quarry", 0xFF0000 )
  23.  
  24. while true do
  25.   local command = ""
  26.   local device = ""
  27.   local status = ""
  28.  
  29.   senderID, message, distance = rednet.receive()
  30.   print( senderID .. ": " .. message )
  31.  
  32.   for i in string.gmatch( message,  "%S+" ) do
  33.     if not command then
  34.       command = i
  35.     elseif not device then
  36.       device = i
  37.     else
  38.       status = i
  39.     end
  40.   end
  41.  
  42.   status[device].setColor( color[status] )
  43. end
  44.  
  45. rednet.close( "back" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement