Advertisement
NAPTlME

CircleController

May 11th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. --Circle 2.0 Controller
  2. --NAPTlME
  3.  
  4. rednet.open('right')
  5.  
  6. function isOdd(n)
  7.   if n%2==1 then
  8.     return true
  9.   else
  10.     return false
  11.   end
  12. end
  13.  
  14. while true do
  15.   print("Please enter a diameter between 4 and 88")
  16.   print("Or type down")
  17.   repeat
  18.     input = read()
  19.     if input == "down" then
  20.       rednet.broadcast(input)
  21.     end
  22.     diameter = tonumber(input)
  23.   until diameter
  24.   if diameter then
  25.     rednet.broadcast(diameter)
  26.     radius = math.floor(diameter/2)
  27.     print("Placing Cylinder with radius of "..radius..".")
  28.     if isOdd(diameter) then
  29.       print("Please use 4 turtles with one placed at the corner of a chunk and the others making a 15x15 square")
  30.     else
  31.       print("Please use 4 turtles placed at corners of central chunk.")
  32.     end
  33.     print("And ensure that desired block is in the last slot")
  34.     print("Turtles will place blocks from left to right.")
  35.     if diameter > 80 then
  36.       print("Remain in center chunk to prevent chunk unloading")
  37.     end
  38.     repeat
  39.       term.clearLine()
  40.       id, msg = rednet.receive()
  41.       if msg == "empty" then
  42.         term.write("Please insert more blocks")
  43.       end
  44.       maximum = tonumber(msg)
  45.     until maximum
  46.     print()
  47.     print("Please enter a height between 1 and "..maximum)
  48.     print("Or type 'cancel'")
  49.     repeat
  50.       var = read()
  51.       if var == "cancel" then
  52.         break
  53.       end
  54.       input = tonumber(var)
  55.     until input
  56.     rednet.broadcast(input)
  57.     print("Constructing a cylinder with diameter of "..diameter.." and height of "..input)
  58.   end
  59.   if var ~= 'cancel' then
  60.     repeat
  61.       id,msg = rednet.receive()
  62.     until msg == "Done"
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement