Posted 16 August 2013 - 04:14 PM
Title: "=" expected at line 5 issue, There is one there!
Hey I am writing a turtle program that will dig a variable sized room. It says that at line 5 I need an = sign when I have one there. Could someone check over my code and see what's giving that error?
Hey I am writing a turtle program that will dig a variable sized room. It says that at line 5 I need an = sign when I have one there. Could someone check over my code and see what's giving that error?
-- Variable Box by Bird V0.1
-- Vars
local tArgs = {...}
local length = tonumber tArgs[1]
local width = tonumber tArgs[2]
local height = tonumber tArgs[3]
local isDone = false
local x = 0
local y = 0
local z = 0
local answer
-- Functions
function tfuel(amount)
if turtle.getFuelLevel() < 5 then
turtle.select(16)
turtle.refuel(amount)
turtle.select(1)
end
end
function turnAround()
turtle.turnRight()
turtle.turnRight()
end
function digUp()
repeat
tfuel(1)
turtle.digUp()
turtle.up()
y = y + 1
until y == height
repeat
tfuel(1)
turtle.down()
y = y - 1
until y == 0
end
function dig()
while isDone == false do
if z ~= width then
repeat
digUp()
turtle.forward()
x = x + 1
until x == length
x = 0
turnAround()
repeat
tfuel(1)
turtle.forward()
x = x + 1
until x == length
x = 0
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
z = z + 1
else
isDone = true
end
end
end
--Main Script
textutils.slowPrint("This will dig a room length x width x height")
textutils.slowPrint("First number = length, second = width, third = height")
textutils.slowPrint("You want a room")
print(length)
textutils.slowPrint("by")
print(width)
textutils.slowPrint("by")
print(height)
textutils.slowPrint("hit enter to confirm")
local sEvent, param = os.pullEvent("key")
if sEvent == "key" then
if param == 28 then
dig()
end
end