Posted 18 March 2013 - 08:55 AM
Here is my code:
And here is the pastebin link: http://pastebin.com/qpwwTBmM
This is the error I get:
When I use 'width' in that for loop on line 74, it tells me that it's not a number. I even used tonumber() at the start of the code to make sure it was.
What am I doing wrong?
-- Area Flatten Script 1.0 by oneupe1even of OmegaTEK Industries on the OniTech server
-- Variables
local tArgs = {...}
if #tArgs == 0 then
print("Usage: flat [length] [width]")
return
else
local length = tonumber(tArgs[1])
local width = tonumber(tArgs[2])
end
local turnFlag = true
-- Functions
local function tFuel(amount) -- By Guude
if turtle.getFuelLevel() < 5 then
turtle.select(16)
turtle.refuel(amount)
turtle.select(1)
end
end
local function digMove()
if turtle.detect() then
repeat
turtle.dig()
sleep(.25)
until turtle.detect() == false
tFuel(1)
turtle.forward()
else
tFuel(1)
turtle.forward()
end
end
local function checkTop()
if turtle.detectUp() then
repeat
tFuel(1)
repeat
turtle.digUp()
sleep(.25)
until turtle.detectUp() == false
turtle.up()
until turtle.detectUp() == false
repeat
tFuel(1)
turtle.down()
until turtle.detectDown()
end
end
local function uTurn()
for i = 1, 2 do
turtle.turnRight()
end
end
local function mineLine()
for i = 1, length do
tFuel()
digMove()
checkTop()
end
end
-- Main Script
for i = 1, width do
mineLine()
if turnFlag then
turtle.turnRight()
digMove()
turtle.turnRight()
turnFlag = false
else
turtle.turnLeft()
digMove()
turtle.turnLeft()
turnFlag = true
end
end
And here is the pastebin link: http://pastebin.com/qpwwTBmM
This is the error I get:
When I use 'width' in that for loop on line 74, it tells me that it's not a number. I even used tonumber() at the start of the code to make sure it was.
What am I doing wrong?