Posted 18 November 2012 - 06:11 AM
Hey pro's
i am making a quarry program. but i got an error when it starts… :
my code…
can anyone fix the problem??? ps… i have made vertical and horisontial programs… you can see it in "–" marks…
Please help
- thanks in advance
edit: THIS POST IS SOLVED! THANKS EVERYBODY… :)/>/>
_____________________________________
-mikk809h
ComputerCraft is awesome
i am making a quarry program. but i got an error when it starts… :
Spoiler
MikkAPI:224: attempt to compare string with number expected, got stringmy code…
Spoiler
function p( text )
print( text )
end
function w( text )
write( text )
end
function printCentered( PosY, text )
local x, y = term.getSize()
term.setCursorPos(x, PosY)
p(text)
end
function clear(x,a)
term.clear()
term.setCursorPos(x,a)
end
function goForward()
while not turtle.forward() do
turtle.dig()
sleep(1)
end
end
function goBack()
while not turtle.back() do
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
sleep(1)
end
end
function goUp()
while not turtle.up() do
turtle.digUp()
sleep(1)
end
end
function goDown()
while not turtle.down() do
turtle.digDown()
sleep(1)
end
end
function moveUp(x1)
BootSystematics_MikkAPIAPIS("goUp")
FuelLevel()
p("Starting API...")
for a3 = 1, x1 do
MikkTurtleAPI.goUp()
end
end
function moveDown(x2)
BootSystematics_MikkAPIAPIS("goDown")
FuelLevel()
p("Starting API...")
for a3 = 1, x2 do
MikkTurtleAPI.goDown()
end
end
function moveForward(x3)
BootSystematics_MikkAPIAPIS("goForward")
FuelLevel()
p("Starting API...")
for a3 = 1, x3 do
MikkTurtleAPI.goForward()
end
end
function turn(Bolean)
if Bolean == right or Bolean == "right" or Bolean == Right or Bolean == "Right" then
while not turtle.turnRight() do
sleep(1)
end
elseif Bolean == left or Bolean == "left" or Bolean == Left or Bolean == "Left" then
while not turtle.turnLeft() do
sleep(1)
end
end
end
function FuelLevel()
while turtle.getFuelLevel() < 100 do
clear(1,1)
p("I need fuel in slot number \"1\"")
turtle.select(1)
while not turtle.refuel() do
clear(1,1)
p("I need fuel.. put fuel in slot \"1\"")
end
end
end
--[Calling In-Game-Action IGA]--
function BootSystematics_MikkAPIAPIS( ApiChoose )
os.loadAPI("MikkTurtleAPI")
os.loadAPI("MikkConsoleAPI")
os.loadAPI("turtle")
clear(1,1)
printCentered( 7, "The Following API, has been entered: \""..ApiChoose.."\"")
sleep(0.7)
printCentered( 1, "Please Wait, while booting \""..ApiChoose.."\"")
sleep(2)
clear(1,1)
printCentered( 3, "Starting \""..ApiChoose.."\"")
end
--[In-Game Functions...]--
function doWall( high, length, SlotNum )
function placeDown()
while not turtle.placeDown() do
if SlotNum < 16 then
turtle.select(SlotNum+1)
SlotNum = SlotNum + 1
else
turtle.select(1)
SlotNum = 1
end
clear(1,1)
turtle.digDown()
sleep(1)
end
end
function place()
while not turtle.place() do
if SlotNum < 16 then
turtle.select(SlotNum+1)
else
turtle.select(1)
end
clear(1,1)
turtle.dig()
sleep(1)
end
end
function placeUp()
while not turtle.placeUp() do
if SlotNum < 16 then
turtle.select(SlotNum+1)
else
turtle.select(1)
end
clear(1,1)
turtle.digUp()
sleep(1)
end
end
function NextRow()
goForward()
for a0 = 1, high do
goDown()
end
end
function Build()
FuelLevel()
p("Starting API...")
for a1 = 1, length do
for a2 = 1, high do
goUp()
placeDown()
end
NextRow()
end
end
BootSystematics_MikkAPIAPIS( "doWall" )
turtle.select(SlotNum)
Build()
end
function doQuarry()
function NextRow1()
turtle.turnRight()
goForward()
turtle.turnLeft()
for hei0 = 1, heiTT2 - 1 do
goDown()
end
end
function NextLvl1()
turtle.turnLeft()
goForward()
for wid = 1, widTT2 - 1 do
goForward()
end
turtle.turnRight()
goForward()
end
function NextRow2()
turtle.turnRight()
goForward()
turtle.turnRight()
goForward()
for len0 = 1, lenTT1 - 1 do
goForward()
end
turtle.turnRight()
turtle.turnRight()
end
function NextLvl2()
turtle.turnLeft()
goForward()
for wid0 = 1, widTT1 - 1 do
goForward()
end
turtle.turnRight()
goDown()
end
--[verticalised tunnel/hole]--
function QuarryVert1()
for hei2 = 1, heiTT1 do
for wid2 = 1, widTT1 do
for len2 = 1, lenTT1 do
turtle.digDown()
lenv = tonumber(len2) -- error ? is here.
if lenv < lenTT1 then -- error ? is here.
goForward()
end
end
goBack()
widv = tonumber(wid2) -- error ? is here.
if widv < widTT1 then -- error ? is here.
NextRow2()
end
end
NextLvl2()
end
for heiUp = 1, heiTT1 do
goUp()
end
end
--[horisontial tunnel]--
function QuarryHori1()
for len1 = 1, lenTT2 do
for wid1 = 1, widTT2 do
for hei1 = 1, heiTT2 do
turtle.dig()
heic = tonumber(hei1)
if heic < heiTT2 then
goUp()
end
end
goDown()
widc = tonumber(wid1) -- error ? is here...
if widc < widTT2 then -- error ? is here.
NextRow1()
end
end
NextLvl1()
end
for heiBack = 1, lenTT2 do
goBack()
end
end
function QuarryVert() -- asking how the tunnel size...
clear(1,1)
w("Width? > ")
widTT1 = read()
clear(1,1)
w("Length? > ")
lenTT1 = read()
clear(1,1)
w("size? \(how many rows it will dig down\) > ")
heiTT1 = read()
FuelLevel()
QuarryVert1()
end
function QuarryHori()
clear(1,1)
w("Width? > ")
widTT2 = read()
clear(1,1)
w("Height? > ")
heiTT2 = read()
clear(1,1)
w("Length? \(the length of the tunnel\) > ")
lenTT2 = read()
FuelLevel()
QuarryHori1()
end
BootSystematics_MikkAPIAPIS("doQuarry")
verHor = true
while verHor do
clear(1,1)
p("Do you want the quarry, Vertical or Horisontial? Vertical is downwards, Horisontial is straight ahead...")
w(" Answer >>---> ")
VH1 = read()
if VH1 == "Vertical" or VH1 == "vertical" or VH1 == Vertical or VH1 == vertical then
verHor = false
QuarryVert()
elseif VH1 == "Horisontial" or VH1 == "horisontial" or VH1 == Horisontial or VH1 == horisontial then
verHor = false
QuarryHori()
else
verHor = true
clear(1,1)
p("Your answer does not match to Horisontial or Vertical ... Try again")
end
end
end
can anyone fix the problem??? ps… i have made vertical and horisontial programs… you can see it in "–" marks…
Please help
- thanks in advance
edit: THIS POST IS SOLVED! THANKS EVERYBODY… :)/>/>
_____________________________________
-mikk809h
ComputerCraft is awesome