Sign up
Login
New paste
English
English
Português
Sign up
Login
New Paste
Browse
function Save(file, data) io.output("Saves/"..file) io.write(data) io.close() end function Read(file) io.input("Saves/"..file) i = tonumber(io.read()) return i end function InventoryFull() for **1, 16 do turtle.select(i) if turtle.getItemCount() == 0 then return false end end return true end function Empty() for **1, 16 do turtle.select(i) full = turtle.drop() if full == false then return full end end end function TurnDirection(direction, turns) io.input("Saves/direction") if direction == "right" then i = io.read() + turns while i > 4 do i = i-4 end else i = io.read() - turns while i < 1 do i = i+4 end end Save("direction", i) return(i) end function MoveHorizontal(len, directionStr, breakmode) currDirection = Read("direction") finaldirection = currDirection direction = tonumber(directionStr) if direction > currDirection then turns = direction - currDirection for **1,turns,1 do turtle.turnRight() end finaldirection = TurnDirection("right", turns) elseif direction < currDirection then turns = currDirection - direction for **1,turns,1 do turtle.turnLeft() end finaldirection = TurnDirection("left", turns) end moved = 0 for **1,len do while turtle.detect() == true do if breakmode == true then turtle.dig() else break end end turtle.forward() moved = moved+1 end if finaldirection == 1 then Save("z", Read("z")-moved) elseif finaldirection == 2 then Save("x", Read("x")+moved) elseif finaldirection == 3 then Save("z", Read("z")+moved) elseif finaldirection == 4 then Save("x", Read("x")-moved) end end function MoveVertical(len, direction, breakmode) if direction == "up" then moved = 0 for **1,len do while turtle.detectUp() == true do if breakmode == true then turtle.digUp() else break end end turtle.up() moved = moved+1 end Save("y", Read("y")+moved) elseif direction == "down" then moved = 0 for **1,len do while turtle.detectDown() == true do if breakmode == true then turtle.digDown() else break end end turtle.down() moved = moved+1 end Save("y", Read("y")-moved) end end function Tunnel(height, width) startX = Read("x") startY = Read("y") startZ = Read("z") startDirection = Read("direction") depth = 0 heightNum = tonumber(height) widthNum = tonumber(width) if startDirection == 1 then rightDirection = 2 leftdirection = 4 homeDirection = 3 elseif startDirection == 2 then rightDirection = 3 leftdirection = 1 homeDirection = 4 elseif startDirection == 3 then rightDirection = 4 leftdirection = 2 homeDirection = 1 elseif startDirection == 4 then rightDirection = 1 leftDirection = 3 homeDirection = 2 end while true do MoveVertical(heightNum-1, "up", true) MoveHorizontal(1, startDirection, true) depth = depth+1 for **1, heightNum, 2 do MoveHorizontal(widthNum-1, rightDirection, true) MoveVertical(1, "down", true) MoveHorizontal(widthNum-1, leftDirection, true) MoveVertical(1, "down", true) end MoveVertical(1, "up", true) if InventoryFull() == true then MoveHorizontal(depth, homeDirection, true) if Empty() == false then break end MoveHorizontal(depth, startDirection, true) end end end --Startup print("Set Location?") print("1. Yes") print("2. No") if read() == "1" then print("X Location") local xCoordinate = read() Save("x", xCoordinate) print("Y Location") local yCoordinate = read() Save("y", yCoordinate) print("Z Location") local zCoordinate = read() Save("z", zCoordinate) print("Direction Facing") local direction = read() Save("direction", direction) end --Main Tunnel(3,3)
Paste Settings
Paste Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English
Português
Do you like cookies?
🍪 We use cookies to ensure you get the best experience on our website.
Learn more
I agree