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

Can anyone tell me what is wrong with this turtle mining program?

Started by forestman11, 27 November 2013 - 03:56 PM
forestman11 #1
Posted 27 November 2013 - 04:56 PM
Hello everyone. I've recently taken an interest in creating mining programs for turtles instead of just downloading them. I realize this could probably be done much better but this is my first program and feel pretty rewarded having made it. However, there seems to be a problem with it somewhere. The turtle is giving me this error code: [string "StripMiner"]:94: '=' expected
I checked line 94 and there is, in fact, an equals sign. I've checked all over and cannot seem to find a problem so I was hoping someone else could give it a shot.
Here: http://pastebin.com/C5qZwWPD is the pastebin link and also in a spoiler:
Spoiler
– Repeats X. X does 5 tunnels
for c=1,5 do

for a=1,50 do
turtle.dig()
turtle.forward()
turtle.digUp()
end

for b=1,50 do
turtle.back()
end

turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()

end
– The above line and up (Other than the top line) is X

– "cancels out" last part of X to get back into tunnel
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()

– Goes back to the beginning of the last tunnel
for d=1,50 do
turtle.forward()
end


– Goes to original point
turtle.turnRight()
for e=1,8 do
turtle.forward()
end

– Dumps everything out of the turtle
turtle.turnLeft()
turtle.select(1)
turtle.drop(64)
turtle.select(2)
turtle.drop(64)
turtle.select(3)
turtle.drop(64)
turtle.select(4)
turtle.drop(64)
turtle.select(5)
turtle.drop(64)
turtle.select(6)
turtle.drop(64)
turtle.select(7)
turtle.drop(64)
turtle.select(8)
turtle.drop(64)
turtle.select(9)
turtle.drop(64)
turtle.select(10)
turtle.drop(64)
turtle.select(11)
turtle.drop(64)
turtle.select(12)
turtle.drop(64)
turtle.select(13)
turtle.drop(64)
turtle.select(14)
turtle.drop(64)
turtle.select(15)
turtle.drop(64)
turtle.select(16)
turtle.drop(64)


– Continues on to mine 5 more tunnels
turtle.turnLeft()
for f=1,8 do
turtle.forward()
end
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft

– Same thing as X, just doing 5 more tunnels
for z=1,5 do

for h=1,50 do
turtle.dig()
turtle.forward()
turtle.digUp()
end

for i=1,50 do
turtle.back()
end

turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()

end

– Same deal again, "cancelling out" the last part of X to get back into the tunnel
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()

– Goes to back to the beginning of the tunnel again
for j=1,50 do
turtle.forward()
end

– Goes to the inital point
turtle.turnRight()
for k=1,18 do
turtle.forward()
end

– Dumps everything out of the turtle
turtle.turnLeft()
turtle.select(1)
turtle.drop(64)
turtle.select(2)
turtle.drop(64)
turtle.select(3)
turtle.drop(64)
turtle.select(4)
turtle.drop(64)
turtle.select(5)
turtle.drop(64)
turtle.select(6)
turtle.drop(64)
turtle.select(7)
turtle.drop(64)
turtle.select(8)
turtle.drop(64)
turtle.select(9)
turtle.drop(64)
turtle.select(10)
turtle.drop(64)
turtle.select(11)
turtle.drop(64)
turtle.select(12)
turtle.drop(64)
turtle.select(13)
turtle.drop(64)
turtle.select(14)
turtle.drop(64)
turtle.select(15)
turtle.drop(64)
turtle.select(16)
turtle.drop(64)

– faces the original position
turtle.turnRight()
turtle.turnRight()
Lyqyd #2
Posted 27 November 2013 - 05:02 PM
Check out the Read This Post Before Asking Questions sticky topic. This problem is covered in the Common Errors section (though you'll have to look more than one line above, to the previous line with code on if).
forestman11 #3
Posted 27 November 2013 - 05:15 PM
Thank you :)/> I actually read the sticky and looked for the parentheses I'm just stupid and didn't notice it haha. I appreciate it.
forestman11 #4
Posted 28 November 2013 - 02:49 AM
So I've been making this new turtle program trying to get a feel for it. I've never actually programmed before so I don't have much experience. Anyway, I thought I had this thing right but apparently not. What it should be doing is digging down right before bedrock, mining a 2x2 tunnel 50 blocks long, coming back, going up to its starting point, dumping the stuff off, going back down, turning, making another 2x2 tunnel 50 blocks long, coming back, dumping the stuff off and continue doing this until it forms a plus shape of tunnels, all the stuff is in the chest and it's sitting and its initial point. Instead what it is doing is mimicking the things it should be except it won't move down at all. No errors or anything, just that. Here is the pastebin link: http://pastebin.com/evxTDCtA# hopefully someone can figure this out because I sure can't. Thanks.
Bomb Bloke #5
Posted 28 November 2013 - 03:29 AM
Has the turtle been fueled? If you type "refuel all" into the command line, it'll consume any available fuel items in its inventory and/or report to you how much juice it's got.

See turtle.getFuelLevel() and turtle.refuel() if you wish to incorporate this sort of thing into your script directly.
forestman11 #6
Posted 28 November 2013 - 12:40 PM
Well I'll be damned. I guess it never occurred to me that just because the fuel is off on my server doesn't mean it will be off on a single player world. I feel extremely stupid now. Thank you, though. You just saved me another day of head scratching. :)/>