Advertisement
subzero22

tekkit wall

Sep 2nd, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Wall v2.0
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. print("Wall 2.0 by subzero22")
  6. print("This code was originally for a new version of CC. It has been edited for an older version to be used in tekkit and so it might have some bugs.")
  7. print()
  8. print("Put the block you want to build with in slot 9")
  9. print()
  10.  
  11. function tall()
  12.   print("How tall do you want it?")
  13.   write("> ")
  14.   t = tonumber(read())
  15.  if t then
  16.  else
  17.    print("Please enter a number.")
  18.    return tall()
  19.  end
  20. end
  21. tall()
  22.  
  23. function wall()
  24.   print("How wide should it be?")
  25.   write("> ")
  26.   w = tonumber(read())
  27.  if w then
  28.  else
  29.    print("Please enter a number.")
  30.    return wall()
  31.  end
  32. end
  33. wall()
  34.  
  35. print("Build left or right?")
  36. write("> ")
  37. left = string.lower(read())
  38.  
  39. a = 1
  40. c = 1
  41. t = t - 1
  42. h = 1
  43. turtle.select(1)
  44.  
  45. function check()
  46.   if turtle.getItemCount(c) == 0 then
  47.     c = c + 1
  48.     turtle.select(c)
  49.     sleep(0.2)
  50.     check()
  51.   elseif c == 9 and turtle.getItemCount(9) <= 0 then
  52.     print("Turtle ran out of resources to build with.")
  53.     print("Please put more stuff in turtle and press any key to continue.")
  54.     os.pullEvent("key")
  55.     c = 1
  56.     turtle.select(c)
  57.     sleep(0.2)
  58.     check()
  59. --[[  elseif turtle.compareTo(16) == false then
  60.     c = c + 1
  61.     select(c)
  62.     sleep(0.2)
  63.     check()
  64. ]]
  65.   end
  66. end
  67.  
  68.  
  69.  
  70. function place()
  71. check()
  72. while not turtle.place() do
  73. turtle.dig()
  74. --turtle.attack()
  75. end
  76. end
  77.  
  78.  
  79. function up()
  80. for i=1,t do
  81. place()
  82. while not turtle.up() do
  83. --turtle.attackUp()
  84. turtle.digUp()
  85. end
  86. end
  87. place()
  88. end
  89.  
  90. function down()
  91. for i=1,t do
  92. place()
  93. while not turtle.down() do
  94. --turtle.attackDown()
  95. turtle.digDown()
  96. end
  97. end
  98. place()
  99. end
  100.  
  101. function wall()
  102. if a == 1 then
  103. up()
  104. a = 0
  105. else
  106. down()
  107. a = 1
  108. end
  109. end
  110.  
  111. function turn()
  112. if left == "left" then
  113. turtle.turnLeft()
  114. while not turtle.forward() do
  115. --turtle.attack()
  116. turtle.dig()
  117. end
  118. turtle.turnRight()
  119. else
  120. turtle.turnRight()
  121. while not turtle.forward() do
  122. --turtle.attack()
  123. turtle.dig()
  124. end
  125. turtle.turnLeft()
  126. end
  127. end
  128.  
  129. for l=1,w do
  130. wall()
  131. turn()
  132. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement