jonassvensson4

REDNET - Dator 1

Aug 18th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ### DATOR 1
  2.  
  3. rednet.open("SIDA")
  4.  
  5. -- COMMAND LIST
  6. print("Type 'wheat on/off' to enable/disable wheat farm")
  7. print("Type 'blaze on/off' to enable/disable tree farm")
  8. print("Type 'rubber on/off' to enable/disable rubber farm")
  9. print("Type 'quarry on/off to enable/disable rubber farm")
  10.  
  11. local state_wheat   = false
  12. local state_blaze   = false
  13. local state_rubber  = false
  14. local state_quarry      = false
  15. -- ON
  16. while ( true ) do
  17.     local message = read()
  18.    
  19.     if message == "wheat on" then
  20.         state_wheat = true
  21.         rednet.send(ID, "won")
  22.     elseif message == "blaze on" then
  23.         state_blaze = true
  24.         rednet.send(ID, "bon")
  25.     elseif message == "quarry on" then
  26.         state_quarry = true
  27.         rednet.send(ID, "qon")
  28.     elseif message == "rubber on" then
  29.         state_rubber = true
  30.         rednet.send(ID, "ron")
  31.     end
  32.  
  33.     -- OFF
  34.     if message == "wheat off" then
  35.         state_wheat = false
  36.         rednet.send(ID, "woff")
  37.     elseif message == "blaze off" then
  38.         state_blaze = false
  39.         rednet.send(ID, "boff")
  40.     elseif message == "quarry off" then
  41.         state_quarry = false
  42.         rednet.send(ID, "qoff")
  43.     elseif message == "rubber off" then
  44.         state_rubber = false
  45.         rednet.send(ID, "roff")
  46.     end
  47.    
  48.     term.clear()
  49.     term.setCursorPos(1, 1)
  50.     -- Lista skiten
  51.     if( state_wheat ) then
  52.         print("Wheat farm [enabled]")
  53.     else
  54.         print("Wheat farm [disabled]")
  55.     end
  56.         if( state_quarry ) then
  57.         print("Quarry [enabled]")
  58.     else
  59.         print("Quarry [disabled]")
  60.     end
  61.  
  62.     if( state_blaze ) then
  63.         print("Blaze farm [enabled]")
  64.     else
  65.         print("Blaze farm [disabled]")
  66.     end
  67.    
  68.     if( state_rubber ) then
  69.         print("Rubber farm [enabled]")
  70.     else
  71.         print("Rubber farm [disabled]")
  72.     end
  73.    
  74.     sleep( 0.1 )
  75. end
Advertisement
Add Comment
Please, Sign In to add comment