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

building API:building with turtles made easy!

Started by Jappards, 14 April 2013 - 08:11 PM
Jappards #1
Posted 14 April 2013 - 10:11 PM
i made a building API for easier building with turtles.
version:
0.1.0
code:
Spoiler

function version()--return the current version.
return "0.1.0"
end
function floorLine(length)--builds 1 line for the floor.
for i=1,length do
  turtle.placeDown()
  turtle.forward()
end
end
function wallLine(hight)--builds a 1x1xhight tower.
for i=1,hight do
  turtle.place()
  turtle.up()
end
end
function ceilingLine(length)--builds a 1xlengthx1 ceiling.
for i=1,length do
  turtle.placeUp()
  turtle.forward()
end
end
function forward(blocks)--goes forward a certain amount of blocks, you may use it, but i dont support that, use at your own risk!
for i=1,blocks do
  forward()
end
end
function floor(lenght,width)--makes a lenghtxwidthx1 floor
for i=2,width do
  floorLine(lenght)
  turtle.back()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  floorLine(lenght)
  turtle.back()
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
end
end
function downward(hight)--makes it go downward a certain number of blocks, you may use it, but i dont support it, use at your own risk!
for i=1,hight do
  turtle.down()
end
end
function wall(hight,length)--makes a hightxlenghtx1 wall.
for i=1,length do
  wallLine(hight)
  turtle.down()
  turtle.turnRight()
  turtle.forward()
  turtle.turnLeft()
  downward(hight)
end
end
function ceiling(lenght,width)--makes a lenghtxwidthx1 ceiling
for i=2,width do
  ceilingLine(lenght)
  turtle.back()
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()
  ceilingLine(lenght)
  turtle.back()
  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()
end
end

overview:
Spoiler

version()--returns current version
floorLine(length)--builds 1 line of the floor
wallLine(hight)--builds a 1x1xhight tower.
ceilingLine(length)--builds a 1xlengthx1 ceiling.
forward(blocks)--goes forward a certain amount of blocks, you may use it, but i dont support that, use at your own risk!
floor(lenght,width)--makes a lenghtxwidthx1 floor
downward(hight)--makes it go downward a certain number of blocks, you may use it, but i dont support it, use at your own risk!
wall(hight,length)--makes a hightxlenghtx1 wall.
ceiling(lenght,width)--makes a lenghtxwidthx1 ceiling.

how to use:
  1. put os.loadAPI("building") on the begin of your scrip/startup
  2. use on of these functions.
  3. enjoy programming!
please reply if you want any building function in it, because this program isn`t optimal.
Jappards #2
Posted 15 April 2013 - 05:20 AM
why is nobody using it?
cogilv25 #3
Posted 15 April 2013 - 02:37 PM
I think it's just not got enough in it… maybe make a program and not an API if it's going to build stuff people who are programming builders will probably already have their own API's for this