This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
michielewiel's profile picture

Turtle build script

Started by michielewiel, 04 April 2012 - 03:29 PM
michielewiel #1
Posted 04 April 2012 - 05:29 PM
Hey forums this is a litlle script i made just as a test on a server but it is capable of building stuff. My friend kinda pushed me into posting it. anyway i want to add some more things but i am gone for a week so i already posted this .Have fun ;p

ps: the platform is a script made by Vliekkie


print(" shape maker 1.0 beta build made by michiel and used a bit of code of Vliekkie")
print("what shoud i make?(choose between line,retangle, wall, cube, square, platform stair or tower)")
local choise = io.read()
if choise == "retangle" then
print(" What size horiozontaly?")
sleep(2)
h = io.read()
h = h-1
h = tonumber(h)
print("what size vertical?")
v = io.read()
v = tonumber(v)
if h <= 0 then
print("error it can not be 0")
end
if v <= 0 then
print("error it can not be 0")
end
if turtle.detectDown()then
turtle.up()
end
for i=1,v do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.turnRight()
for i=1,h do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.turnRight()
for i=1,v do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.turnRight()
for i=1,h do
print(i) 
turtle.placeDown()
turtle.forward()
end
if choise == "square" then
print("how long does it need to be?")
local s = io.read()
local x = s-1
s = tonumber(s)
x = tonumber(x)
if s <= 0 then
print("error length can not be 0")
sleep(2)
end
if turtle.detectDown()then
turtle.up()
end
for i=1,s do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.back()
turtle.turnRight()
for i=1,s do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.back()
turtle.turnRight()
for i=1,s do
print(i)
turtle.placeDown()
turtle.forward()
end
turtle.back()
turtle.turnRight()
for i=1,x do
print(i)
turtle.placeDown()
turtle.forward()
end
os.shutdown()
end
end
if choise == "line" then
print("how long does the line need to be?")
local ll = io.read()
ll = tonumber(ll)
if ll <= 0 then
print("error length line can not be 0")
os.shutdown()
end
if turtle.detectDown() then
turtle.up()
end
for i=1, ll do
print(i)
turtle.placeDown()
turtle.forward()
end
end
if choise == "stair" then
print("how long does it need to be?")
local wl = io.read()
wl = tonumber(wl)
print("how high does it need to be?")
local wh = io.read()
wh = tonumber(wh)
if  wh <= 0 then
print("error the higth can not be zero")
sleep(1)
os.shutdown()
end
if wl <= 0 then
print("error the length can not be 0")
sleep(1)
os.shutdown()
end
if turtle.detectDown() then
turtle.up()
end
turtle.turnRight()
for i=1 , wh do
for i=1 , wh do
print(i)
turtle.placeDown()
turtle.up()
turtle.forward()
end
for i=1 , wh do
turtle.down()
end
end
end
if choise == "tower" then
print("how long does it need to be?")
local cl = io.read()
cl = tonumber(cl)
print("how high does it need to be?")
local ch = io.read()
ch = tonumber(ch)
local clt = cl-1
clt = tonumber(clt)
local cltr = cl-2
cltr = tonumber(cltr)
if ch <= 0 then
print("error the higth can not be 0")
os.shutdown()
end
if cl <= 0 then
print("error it can not 0")
os.shutdown()
end
if turtle.detectDown() then
turtle.up()
end
for i=1 , cl do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , clt do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , clt do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , cltr do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
turtle.forward()
for i=1, ch do
turtle.down()
end
end
end
if choise == "wall" then
print("how long does it need to be?")
local wl = io.read()
wl = tonumber(wl)
print("how high does it need to be?")
local wh = io.read()
wh = tonumber(wh)
if  wh <= 0 then
print("error the higth can not be zero")
sleep(1)
os.shutdown()
end
if wl <= 0 then
print("error the length can not be 0")
sleep(1)
os.shutdown()
end
if turtle.detectDown() then
turtle.up()
end
turtle.turnRight()
for i=1 , wh do
for i=1 , wh do
print(i)
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1 , wh do
turtle.down()
end
end
end
if choise == "cube" then
print("how long does it need to be?")
local cl = io.read()
cl = tonumber(cl)
print("how high does it need to be?")
local ch = io.read()
ch = tonumber(ch)
local clt = cl-1
clt = tonumber(clt)
local cltr = cl-2
cltr = tonumber(cltr)
if ch <= 0 then
print("error the higth can not be 0")
os.shutdown()
end
if cl <= 0 then
print("error it can not 0")
os.shutdown()
end
if turtle.detectDown() then
turtle.up()
end
for i=1 , cl do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , clt do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , clt do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
for i=1, ch do
turtle.down()
end
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for i=1 , cltr do
for i=1, ch do
turtle.placeDown()
turtle.up()
end
turtle.forward()
turtle.forward()
for i=1, ch do
turtle.down()
end
end
end
if choise == "platform" then
if turtle.detectDown() then
turtle.up()
end
term.clear()
term.setCursorPos(1,1)
print("how Long?")
a=tonumber(read())
term.setCursorPos(1,3)
term.clearLine()
print("how Wide?")
b=tonumber(read())
turtle.placeDown()
x=1
y=0
s=1
print("using slot " ..s)
  while y<b do
   y=y+1
	    while x<a do
	    x=x+1
			    turtle.forward()
			    turtle.placeDown()
				   if turtle.getItemCount(s)==0 then
				   s=s+1
		 print("now using slot " ..s)
turtle.select(s)
end 
end
x=1
q=tonumber(y)
if q%2==1 then
turtle.turnRight()
turtle.forward()
turtle.placeDown()
turtle.turnRight()
elseif q%2==0 then
turtle.turnLeft()
turtle.forward()
turtle.placeDown()
turtle.turnLeft()
end
end
term.clear()
term.setCursorPos(1,1)
print("done")
end


you can do what you want with this script
grumpysmurf #2
Posted 19 April 2012 - 03:13 PM
I used this to build dirt platforms over my quarries. Fantastic!
thetravis0916 #3
Posted 14 January 2013 - 04:48 PM
Can you post this on pastebin?
soccerpro04 #4
Posted 19 May 2013 - 01:14 AM
AAAAAHHHHHHHH!!!!!!!!!!!WHY CANT I COPY AND PASTE THIS TO THE STUPID TURTLE?!I HATE THIS!!!!!!Ok,can you PLEASE,help me?this is so darn difficult!
recondelta090 #5
Posted 19 May 2013 - 06:29 PM
This is now on PasteBin
just type in your turtle console:
pastebin get vxutCdjt Builder
And then type Builder in the console to start it.