Posted 26 February 2012 - 04:32 PM
Quick script I wrote last night.
Works with either glowstone or torches with a different mode for each. Will work with redstone lamps, redpower lights and so on aswell (hence why parameter is block not glowstone)
Simply run:
The turtle must be placed on the floor of the tunnel facing the right direction.
Code:
Its not great but it works, blocks it automatically digs a hole in the floor and places them.
The light sources go in slot 9 (which it says in the program)
Might update it to dig the tunnels aswell.
Works with either glowstone or torches with a different mode for each. Will work with redstone lamps, redpower lights and so on aswell (hence why parameter is block not glowstone)
Simply run:
lightup 200 torch
to place torches evenly down a 200 block tunnel, don't worry if the tunnel is shorter it will detect the obstruction and stop. sub torch for block to place blocks instead.The turtle must be placed on the floor of the tunnel facing the right direction.
Code:
tArgs = { ... }
if (#tArgs ~= 2) or (tonumber(tArgs[1]) < 8) or (((tArgs[2] == "torch")or(tArgs[2] == "block")) == false) then
print("Usage: lightup <distance> <torch/block>")
print("Light Source Must Be Placed In Slot 9")
if tonumber(tArgs[1]) < 8 then
print("Distance must be greater than 8")
end
if (((tArgs[2] == "torch")or(tArgs[2] == "glowstone")) == false) then
print(tArgs[2])
print("Must enter torch or glowstone")
end
return
end
turtle.select(9)
distance = tonumber(tArgs[1])
if turtle.getItemCount(9) < 1 then
print("No torches left")
distance = 0
end
if tArgs[2] == "torch" then
turtle.up()
end
while distance > 8 do
for y = 1, 8 do
if turtle.forward() == true then
distance = distance - 1
else
print("Obstruction Hit")
distance = 0
end
end
if turtle.getItemCount(9) < 1 then
print("No torches left")
distance = 0
else
turtle.digDown()
turtle.placeDown()
end
end
if tArgs[2] == "torch" then
turtle.down()
end
Its not great but it works, blocks it automatically digs a hole in the floor and places them.
The light sources go in slot 9 (which it says in the program)
Might update it to dig the tunnels aswell.