Posted 07 June 2012 - 04:15 AM
I'm getting the following error: (copied exactly from turtle)
disk> test
bios:206: [string "miner"]:89:
unexpected symbol
test:3: attempt to index ? (a nil value)
disk>
Here is my code:
miner
test
Any help would be very appreciated.
disk> test
bios:206: [string "miner"]:89:
unexpected symbol
test:3: attempt to index ? (a nil value)
disk>
Here is my code:
miner
Spoiler
function mineForward1()
while(turtle.forward()==false) do
turtle.dig()
sleep(0.3)
end
return true
end
function mineForward(n)
local i = 0
while(i<n) do
mineForward1()
i = i + 1
end
return true
end
function mineUp1()
while(turtle.up()==false) do
turtle.digUp()
sleep(0.3)
end
return true
end
function mineUp(n)
local i = 0
while(i<n) do
mineUp1()
i = i + 1
end
return true
end
function mineDown1()
while(turtle.down()==false) do
turtle.digDown()
sleep(0.3)
end
return true
end
function mineDown(n)
local i = 0
while(i<n) do
mineDown1()
i = i + 1
end
return true
end
function backUp(n)
local i = 0
while(i<n) do
while(turtle.back()==false) do
sleep(0.1)
end
i = i + 1
end
return true
end
function turnAround()
turtle.turnLeft()
turtle.turnLeft()
return true
end
function place(n)
turtle.select(n)
turtle.place()
return true
end
function digRoomLayer(width, PT)
for i=1, width-2 do
mineForward(i)
turtle.turnLeft()
mineForward(i)
turtle.turnLeft()
end
for i=1, 3 do
mineForward((n-1)/2+1)
if PT then
turnAround()
place(1)
turnAround()
end
mineForward((n-1)/2)-1)
turtle.turnLeft()
end
mineForward(2)
turtle.turnRight()
backUp(1)
if PT then
place(1)
end
backUp((n-1)/2-1)
return true
end
function digRoom(width, height)
digRoomLayer(width, true)
for i=1, height-1 do
mineDown(1)
digRoomLayer(width, false)
end
return true
end
test
os.loadAPI("miner")
miner.mineForward(10)
miner.mineUp(1)
miner.digRoom(5, 3)
miner.turnAround()
miner.mineForward(10)
miner.turnAround()
miner.mineUp(1)
os.unloadAPI("miner")
Any help would be very appreciated.