Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin run FuQ3WvPs 963AtZS3 quickMove
- function act(word)
- local command_table = {
- f = turtle.forward,
- b = turtle.back,
- tr = turtle.turnRight,
- tl = turtle.turnLeft,
- ta = turtle.turnAround,
- d = turtle.dig,
- dd = turtle.digDown,
- du = turtle.digUp,
- u = turtle.up,
- dn = turtle.down,
- p = turtle.place,
- pd = turtle.placeDown,
- pu = turtle.placeUp
- }
- local w = tostring(word)
- local f = command_table[w]
- if f == nil then return false end
- succ, err = f()
- if not succ then
- print ("I tried and failed, sorry!")
- end
- return succ
- end
- function mmove(path)
- for command in string.gmatch(path, '([^,]+)') do
- local num = string.match(command, '%d+') or 1
- local word = string.match(command, '[^%d]+')
- for i = 1, num do
- if not act(word) then break end
- end
- end
- end
- local args = {...}
- if args[1] == "update" then
- shell.run("pastebin", "run", "FuQ3WvPs 963AtZS3 quickMove")
- else
- while true do
- local input = read()
- if input == "q" then break end
- mmove(input)
- end
- end
Add Comment
Please, Sign In to add comment