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

If You Can Improve, Please

Started by TheMuffinMan, 28 July 2013 - 03:25 PM
TheMuffinMan #1
Posted 28 July 2013 - 05:25 PM
Hey guys, I am a beginner at Lua but I know the basics by watching DireWolf20's CC tutorials on YouTube.

I wrote a mining command for a turtle, and I would like you to look at it and improve it / add some things if you can or want to.
You can get the code by using "pastebin get xGLLAUjY mine"

I hope you can teach me something,
Thanks!
Lyqyd #2
Posted 29 July 2013 - 01:00 PM
Split into new topic.
Cranium #3
Posted 30 July 2013 - 10:33 AM
I'd recommend a move exception catching. You can simply replace your turtle.forward() commands with this function:

local function tryDig()
    if not turtle.dig() then
	    sleep(1)
    end
end

local function tryForward()
    if not turtle.forward() then
	    tryDig()
    end
end
You can replace turtle.forward() with tryForward(). I recommend making a similar one for turtle.up() and turtle.down()