Monday, November 18, 2013

Minecraft
ComputerCraft/Feed The Beast Code
BUILD A WALL THAT CANINDIAN


ComputerCraft is a mod for Minecraft that allows you to program computers called turtles to do work for you. Feed The Beast is a mod pack for Minecraft that has the ComputerCraft mod in it.

This program is one that I made myself that lets you build a wall. The only hold back though is that the width has to be an even number. All you have to do is type (name of program) (hight) (width).


local tArgs = {...}
local todo = tonumber(tArgs[1])
local width = tonumber(tArgs[2])
local sslot = 1

function checkSlot()

turtle.getItemCount(sslot)

while turtle.getItemCount(sslot) < 1 do
  sslot = (sslot%16)+1

turtle.select(sslot)
  end
end


for j = 1, width / 2 do       

if turtle.detect() == true then

checkSlot()
turtle.dig()
turtle.place()

else

checkSlot()
turtle.place()

end

for i = 1, todo - 1 do

turtle.up()
  
if turtle.detect() == true then 
repeat
checkSlot()
turtle.dig()
sleep(0.5)
until turtle.detect() == false

turtle.place()

else

checkSlot()
turtle.place()


   end
 end
  
turtle.turnRight()
turtle.forward()
turtle.turnLeft()

if turtle.detect() == true then

turtle.dig()
checkSlot()
turtle.place()

else
checkSlot()
turtle.place()

end

for i = 1, todo - 1 do

turtle.down()

if turtle.detect() == true then

checkSlot()
turtle.dig()
turtle.place()

else

checkSlot()
turtle.place()

end
    end
 turtle.turnRight()
 turtle.forward()
 turtle.turnLeft()
end        

No comments:

Post a Comment