This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dragonwhiro's profile picture

{lua} '=' error message dig turtle/drop issue

Started by dragonwhiro, 08 April 2013 - 06:49 AM
dragonwhiro #1
Posted 08 April 2013 - 08:49 AM
if turtle.getItemCount(1) > 63 then
turtle.select(1)
turtle.turnRight
turtle.drop()
turtle.turnLeft
end

I have a dect/dig loop above, no issue there so i didnt think i needed to write it. trying to make it turn to drop to chest then turn back to mine again. (alright so i thought i didnt need to write other three lines, since i didnt think it was important… seems it is now)


"turtle.drop()" line is where it is having some problems '=' expected is coming up so i tried turtle.drop and same thing came up.

Am i missing a code within it?

Thanks
Kingdaro #2
Posted 08 April 2013 - 08:51 AM
Add () after "turtle.turnLeft" and "turtle.turnRight".
dragonwhiro #3
Posted 08 April 2013 - 08:54 AM
Thank you, i thought it was in that line since thats what the system was telling me, thanks for the quick fix!


function dect()
if turtle.detect() then
turtle.dig()


if turtle.getItemCount(1) > 63 then
turtle.select(1)
turtle.turnRight()
turtle.drop()
turtle.turnLeft()
end

so i try to start it and no error message yet its not mining the item infront of it, (yes facing the right way)
tried refuel "fuel is 1046" so it has fuel but doesnt want to engage =(
Edited on 08 April 2013 - 07:06 AM
SadKingBilly #4
Posted 08 April 2013 - 09:20 AM
Are you forgetting to call the function? It's not enough to just create a function, you have to tell the turtle to execute it, too. In order to call a function (that is, tell the turtle to execute it), you have to add a line with just the name of the function: "dect()".
gronkdamage #5
Posted 08 April 2013 - 03:17 PM
function dect()
 if turtle.detect() then 
 turtle.dig()


if turtle.getItemCount(1) > 63 then
turtle.select(1)
turtle.turnRight()
turtle.drop()
turtle.turnLeft()
end

you're missing an end on this 'program' - not sure where the function ends.
QuantumGrav #6
Posted 08 April 2013 - 04:29 PM
Two ends actually, but other than that it looks great! Just make sure you call the function!