Advertisement
MrTurtle

House/Tower Builder

May 26th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.43 KB | None | 0 0
  1. print("Loading Robust Turtle API...")
  2. local load = os.loadAPI("t")
  3. if load then
  4.   print("Robust Turtle API loaded.")
  5. else
  6.  print("Robust Turtle API not found in the root directory with filename t")
  7.  print("Attempting to download as t from pastebin...")
  8.  os.sleep(2)
  9.  local response = http.get("http://pastebin.com/raw.php?i= e0UksEtT")
  10.  if response then
  11.     print("Great Success.")    
  12.     local data = response.readAll()
  13.     response.close()
  14.     local file = fs.open("t", "w")
  15.     file.write(data)
  16.     file.close()
  17.     print("Downloaded as t")
  18.     load = os.loadAPI("t")
  19.     if load then
  20.      print("Robust Turtle API installed & loaded.")
  21.     end
  22.  else
  23.     print( "Download Failed. Please Install Manually." )
  24.     return
  25.  end
  26. end
  27.  
  28.  
  29. --haus/tower/skyscraper builder turtle. does not hollow it out.
  30.  
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. local haus={}
  34. local floor={}
  35. print("Haus Builder Turtle.")
  36. print("length?")
  37. local length = t.readNum()
  38. print("width?")
  39. local width = t.readNum()
  40. print("height of each floor?")
  41. local height = t.readNum()
  42. print("number of floors? FYI: max build height is y=256")
  43. local floors = t.readNum()
  44. print("first slot of wall material?")
  45. haus[1] = t.readNum()
  46. print("last slot of wall material? enter same number as the first slot if using only 1 stack.")
  47. haus[2] = t.readNum()
  48. print("first slot of roof/floor material?")
  49. floor[1] = t.readNum()
  50. print("last slot of roof/floor material? enter same number as the first slot if using only 1 stack.")
  51. floor[2] = t.readNum()
  52.  
  53.  
  54. function roof()
  55.     local alternate = "right"
  56.     for i =1, width do
  57.         t.placeRow("down", "forward", length, floor[1], floor[2])
  58.         if alternate == "right" and i~=width then
  59.             t.right()
  60.             t.forward()
  61.             t.right()
  62.             alternate = "left"
  63.         elseif alternate == "left" and i~=width then
  64.             t.left()
  65.             t.forward()
  66.             t.left()
  67.             alternate = "right"
  68.         end
  69.         if alternate == "left" and i==width then
  70.             t.right()
  71.             t.forward(width-1)
  72.             t.right()
  73.         elseif alternate == "right" and i==width then
  74.             t.strafeLeft(width-1)
  75.             t.back(length-1)
  76.         end
  77.     end
  78. end
  79.  
  80.  
  81. roof()
  82. t.up()
  83. for i=1, floors do
  84.   for i=1, height do
  85.     for i=1,2 do
  86.       t.placeRow("down", "forward", length, haus[1],haus[2])
  87.       t.right()
  88.       t.placeRow("down", "forward", width, haus[1],haus[2])
  89.       t.right()
  90.     end
  91.     t.up()
  92.   end
  93.   roof()
  94.   t.up()
  95. end
  96. t.back()
  97. t.down((height+1)*floors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement