Advertisement
thatparadox

ICBMturtle

Dec 24th, 2013
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. if fs.exists("panel") then
  4.   file = fs.open("panel","r")
  5.   panel = tonumber(file.readAll())
  6.   file.close()
  7. else
  8.   term.clear()
  9.   term.setCursorPos(1,1)
  10.   print("Make sure the Linking Book is in my top left slot then enter the ID of the computer with the touch screen attached.")
  11.   write("Touch screen ID: ")
  12.   id = read()
  13.   file = fs.open("panel", "w")
  14.   file.write(id)
  15.   file.close()
  16.   term.clear()
  17.   turtle.select(1)
  18.   turtle.dropDown()
  19.   term.clear()
  20.   term.setCursorPos(1,1)
  21.   print("Complete!")
  22. end
  23.    
  24. while true do
  25.   id, slot = rednet.receive()
  26.   print(slot)
  27.   if id == tonumber(panel) and slot == "off" then
  28.     if turtle.suckDown() then
  29.         rednet.send(tonumber(panel), "true")
  30.     else
  31.         rednet.send(tonumber(panel), "false")
  32.     end
  33.   elseif id == tonumber(panel) then
  34.     turtle.suckDown()
  35.     --os.sleep(.5)
  36.     turtle.select(tonumber(slot))
  37.     if turtle.dropDown() then
  38.       sleep(.1)
  39.       rednet.send(panel, "true")
  40.     else
  41.       sleep(.1)
  42.       rednet.send(panel, "false")
  43.     end
  44.   end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement