Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turtle Programm --
- -- Category: Movement/Mining --
- -- [INFORMATION] --
- local appName = "Move.lua"
- local appType = "Turtle"
- local category = "Movement/Mining"
- local version = "1.0"
- local author = "S3mpx"
- -- print info --
- print("["..appName.."]")
- print("Programm Type: "..appType)
- print("Category: "..category)
- print("Version: "..version)
- print("written by"..author)
- -- [LOCALS] --
- local x = ""
- local y = ""
- -- [FUNKTIONS] --
- -- go(x) --
- local function go(x)
- for i=1, x do
- turtle.dig()
- turtle.forward()
- end
- end
- -- up(x) --
- local function up(x)
- for i=1, x do
- turtle.digUp()
- turtle.up()
- end
- end
- -- down(x) --
- local function down(x)
- for i=1, x do
- turtle.digDown()
- turtle.down()
- end
- end
- -- left(x) --
- local function left(x)
- turtle.turnLeft()
- go(x)
- end
- -- right(x) --
- local function right(x)
- turtle.turnRight()
- go(x)
- end
- -- cobble(x) --
- local function cobble(x)
- for i=1, x do
- if turtle.detect() then
- turtle.dig()
- else
- i = i-1
- end
- end
- end
- -- emptyInventory --
- local function emptyInventory()
- right(0)
- right(0)
- for slot = 1, 16 do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- if not turtle.drop() then
- print("Chest is full or no chest behind. Exiting...")
- return false
- end
- end
- end
- right(0)
- right(0)
- return true
- end
- -- [MAIN FUNKTION] --
- print("When you're done, type 'done'!")
- while true do
- y = io.read()
- if y == "empty" then
- print("emptying inventory...")
- emptyInventory()
- print("success!")
- end
- if y == "cobble" then
- print("how many blocks? (x)")
- x = io.read()
- cobble(x)
- end
- if y == "go" then
- print("go(x)?")
- x = io.read()
- go(x)
- end
- if y == "up" then
- print("up(x)?")
- x = io.read()
- up(x)
- end
- if y == "down" then
- print("down(x)?")
- x = io.read()
- down(x)
- end
- if y == "left" then
- print("left(x)?")
- x = io.read()
- left(x)
- end
- if y == "right" then
- print("right(x)?")
- x = io.read()
- right(x)
- end
- end
- -- [END] --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement