Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Strip testing program for editing and testing by subzero22
- term.clear()
- term.setCursorPos(1,1)
- print("Stripmine v2.0 by subzero22")
- print("This is a program being edited/tested on.")
- print()
- print("How long do you want the tunnels?")
- write("> ")
- x = tonumber( read() )
- print("How wide do you want each strip?")
- write("> ")
- w = tonumber( read() )
- print("How many strips do you want?")
- write("> ")
- r = tonumber( read() )
- -- math to figure if strips is odd or even
- if r%2 == 1 then
- rm = "odd"
- else
- rm = "even"
- end
- print("Would you like the turtle to make the strips left or right?")
- write("> ")
- left = string.lower(read())
- print("Does the turtle have ENDER chest support? (yes/no)")
- print("If so put ender chest in slot 16")
- write("> ")
- ch = string.lower(read())
- if ch == "yes" then
- tslot = 15
- else
- tslot = 16
- end
- print("Would you like it to place torches? (yes/no)")
- print("If so put torches in slot "..tslot)
- torch = string.lower(read())
- if torch == "yes" then
- print("How many spaces do you want each torch to be?")
- print("Recomended 5-6 spaces")
- ts = tonumber( read() )
- end
- if torch == "yes" then
- tp = 14
- else
- tp = 15
- end
- s = 1
- w = w + 1
- rw = w * r
- tl = 1
- mined = 0
- fuel = x * r + w * r + rw
- flvl = turtle.getFuelLevel()
- turtle.select(1)
- while turtle.getFuelLevel() <= fuel do
- print("Turtle has "..flvl.." fuel and needs "..fuel.."fuel to strip this much.")
- print("Please put fuel in slot 1.")
- os.pullEvent("turtle_inventory")
- turtle.refuel(64)
- end
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- print("CONFIRMING SETTINGS:")
- print("")
- print("Strips will be "..x.." long "..w.." wide and will make "..r.." strips.")
- if ch == "yes" then
- print("An Ender chest will be used in slot 16.")
- else
- print("There will be no chest support.")
- end
- if torch == "yes" then
- print("Torches will be places "..ts.." spaces apart and will be in slot"..tslot)
- else
- print("No torches will be used")
- end
- print("Turtle will use about "..fuel.." fuel.")
- sleep(1)
- print("")
- os.pullEvent("key")
- print("")
- print("Stripmine Starting")
- function chest()
- if ch == "yes" then
- if turtle.getItemCount(tp) > 0 then
- turtle.select(16)
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.placeDown()
- end
- for i=1,tp do
- turtle.select(s)
- mined = mined + turtle.getItemCount(s)
- turtle.dropDown()
- s = s + 1
- end
- print(mined.." blocks dumped into chest so far...")
- s = 1
- turtle.select(16)
- turtle.digDown()
- turtle.select(1)
- end
- turtle.select(1)
- end
- end
- function strip()
- chest()
- while not turtle.forward() do
- whilte not turtle.dig() do
- turtle.attack()
- end
- sleep(0.6)
- end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.6)
- end
- while turtle.detectDown() do
- turtle.digDown()
- end
- if torch == "yes" then
- tl = tl + 1
- end
- if tl == ts then
- turtle.select(tslot)
- if turtle.getItemCount(tslot) < 1 then
- print("Turtle is out of torches. Please place more in slot "..tslot)
- os.pullEvent("turtle_inventory")
- else
- turtle.select(tslot)
- if turtle.placeDown() == false then
- if turtle.placeUp() == false then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- turtle.select(1)
- tl = 1
- end
- end
- function turn()
- if left == "left" then
- turtle.turnLeft()
- for i=1,w do
- strip()
- end
- turtle.turnLeft()
- left = "right"
- else
- turtle.turnRight()
- for i=1,w do
- strip()
- end
- turtle.turnRight()
- left = "left"
- end
- end
- function back()
- if rm == "odd" and left == "right" then
- turtle.turnLeft()
- for i=1,rw do
- strip()
- end
- turtle.turnRight()
- for i=1,x do
- strip()
- end
- end
- if rm == "odd" and left == "left" then
- turtle.turnRight()
- for i=1,rw do
- strip()
- end
- turtle.turnLeft()
- for i=1,x do
- strip()
- end
- end
- if rm == "even" and left == "left" then
- turtle.turnRight()
- for i=1,rw do
- strip()
- end
- end
- if rm == "even" and left == "right" then
- turtle.turnLeft()
- for i=1,rw do
- strip()
- end
- end
- end
- for i=1,r do
- for i=1,x do
- strip()
- end
- turn()
- end
- back()
- print("Turtle has completed it's job.")
Advertisement
Add Comment
Please, Sign In to add comment