Xyzzy

quarryctl

Mar 29th, 2015
219
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rednet.open("left")
  2.  
  3. local redS = "top"
  4. local togS = "right"
  5.  
  6.  
  7. while true do
  8.   local id,msg = rednet.receive()
  9.   term.clear()
  10.   term.setCursorPos(1,1)
  11.   print(msg)
  12.   if msg == "startmine" then
  13.     if rs.getInput(redS) == true then
  14.       rs.setOutput(togS, true)
  15.       sleep(0.5)
  16.       rs.setOutput(togS, false)
  17.       rednet.send(id, "nowmine")
  18.       print("nowmine")
  19.     elseif rs.getInput(redS) == false then
  20.       rednet.send(id, "premine")
  21.       print("premine")
  22.     end
  23.   elseif msg == "stopmine" then
  24.     if rs.getInput(redS) == false then
  25.       rs.setOutput(togS, true)
  26.       sleep(0.5)
  27.       rs.setOutput(togS, false)
  28.       rednet.send(id, "nowminestop")
  29.       print("nowminestop")
  30.     elseif rs.getInput(redS) == true then
  31.       rednet.send(id, "preminestop")
  32.       print("preminestop")
  33.     end
  34.   elseif msg == "statmine" then
  35.     if rs.getInput(redS) == true then
  36.       rednet.send(id, "statmineoff")
  37.       print("statmineoff")
  38.     elseif rs.getInput(redS) == false then
  39.       rednet.send(id, "statmineon")
  40.       print("statmineon")
  41.     end
  42.   end
  43. end
RAW Paste Data