Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bry.resetCursor()
- w = 0
- h = 0
- d = 0
- confirm = false
- repeat
- bry.resetCursor()
- print("How wide would you like to clear?")
- print("- "..w.." +")
- print("How high would you like to clear?")
- print("- "..h.." +")
- print("How deep would you like to clear?")
- print("- "..d.." +")
- print("Confirm Cancel")
- print(" ")
- print("Negative width will go left.")
- print("Negative height will go down.")
- local event, button, mouseX, mousey = os.pullEvent("mouse_click")
- if mouseX == 1 and mousey == 2 then
- w = w-1
- elseif mouseX > 4 and mousey == 2 then
- w = w+1
- elseif mouseX == 1 and mousey == 4 then
- h = h-1
- elseif mouseX > 4 and mousey == 4 then
- h = h+1
- elseif mouseX == 1 and mousey == 6 then
- d = d-1
- elseif mouseX > 4 and mousey == 6 then
- d = d+1
- elseif mouseX >= 1 and mouseX <= 8 and mousey == 7 then
- confirm = true
- elseif mouseX >= 15 and mouseX <= 22 and mousey == 7 then
- print("Operation canceled.")
- error()
- end
- until confirm == true
- if h == 0 or w == 0 or d == 0 then
- bry.resetCursor()
- print("Invalid arguments. No number can be 0.")
- error()
- end
- if d < 0 then
- d = -d
- end
- bry.resetCursor()
- print("You'd like me to clear this area?")
- if w > 0 then
- print(w.." wide (Right) ")
- else
- print(-w.." wide (Left)")
- end
- if h > 0 then
- print(h.." high (Up) ")
- else
- print(-w.." wide (Down)")
- end
- print(d.." deep (Forward)")
- print("Confrim Cancel")
- confirm = false
- repeat
- local event, button, mouseX, mousey = os.pullEvent("mouse_click")
- if mouseX >= 1 and mouseX <= 8 and mousey == 5 then
- confirm = true
- print("Order confirmed.")
- elseif mouseX >= 15 and mouseX <= 22 and mousey == 5 then
- print("Operation canceled.")
- error()
- end
- until confirm == true
- confrim = false
- function dig()
- repeat
- turtle.dig()
- turtle.attack()
- until turtle.detect() == false
- end
- if h > 0 then
- function digUp()
- repeat
- turtle.digUp()
- turtle.attackUp()
- until turtle.detectUp() == false
- end
- elseif h < 0 then
- function digUp()
- repeat
- turtle.digDown()
- turtle.attackDown()
- until turtle.detectDown() == false
- end
- end
- function back()
- repeat
- until turtle.back() == true
- end
- if h > 0 then
- function down()
- repeat
- turtle.attackDown()
- until turtle.down() == true
- end
- elseif h < 0 then
- function down()
- repeat
- turtle.attackUp()
- until turtle.up() == true
- end
- end
- function xd()
- repeat
- dig()
- until turtle.forward() == true
- end
- if h > 0 then
- function yd()
- repeat
- digUp()
- until turtle.up() == true
- end
- elseif h < 0 then
- function yd()
- repeat
- digUp()
- until turtle.down() == true
- end
- end
- if w > 0 then
- function turnRight()
- turtle.turnRight()
- end
- elseif w < 0 then
- function turnRight()
- turtle.turnLeft()
- end
- end
- if w > 0 then
- function turnLeft()
- turtle.turnLeft()
- end
- elseif w < 0 then
- function turnLeft()
- turtle.turnRight()
- end
- end
- function rex()
- x = x-1
- end
- function inx()
- x = x+1
- end
- function rey()
- y = y-1
- end
- function iny()
- y = y+1
- end
- function rez()
- z = z-1
- end
- function inz()
- z = z+1
- end
- function didDouble()
- double = true
- end
- function reDouble()
- double = false
- end
- if h < 0 then
- h = -h
- end
- if w < 0 then
- w = -w
- end
- z = 0
- y = 0
- x = 0
- if w*1 == 1 and h*1 == 1 then
- repeat
- xd()
- inz()
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
- error()
- end
- if w*1 == 2 and h*1 == 1 then
- repeat
- xd()
- inz()
- turnRight()
- dig()
- turnLeft()
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
- error()
- end
- if w*1 == 1 and h*1 >= 2 then
- repeat
- xd()
- inz()
- repeat
- yd()
- iny()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
- error()
- end
- if w*1 == 2 and h*1 >=2 then
- repeat
- xd()
- inz()
- turnRight()
- dig()
- repeat
- yd()
- iny()
- dig()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- turnLeft()
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
- error()
- end
- if w*1 >= 3 and h*1 == 1 then
- repeat
- xd()
- inz()
- turnRight()
- repeat
- xd()
- inx()
- until x == w-1
- repeat
- back()
- rex()
- until x == 0
- turnLeft()
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
- error()
- end
- repeat
- xd()
- inz()
- turnRight()
- if w*1 >= 2 then
- dig()
- end
- repeat
- if w*1 >= 2 then
- yd()
- dig()
- iny()
- didDouble()
- else
- yd()
- iny()
- end
- until y == h-1
- repeat
- rey()
- down()
- until y == 0
- wr = w-3
- repeat
- if double == true and wr > x then
- xd()
- inx()
- xd()
- inx()
- dig()
- repeat
- yd()
- iny()
- dig()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- wr = wr-2
- elseif double == true and wr <= x then
- reDouble()
- xd()
- inx()
- xd()
- inx()
- repeat
- yd()
- iny()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- wr = wr-1
- elseif double == false and wr > x then
- didDouble()
- xd()
- inx()
- dig()
- repeat
- yd()
- dig()
- iny()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- wr = wr-2
- else
- xd()
- inx()
- repeat
- yd()
- iny()
- until y == h-1
- repeat
- down()
- rey()
- until y == 0
- wr = wr-1
- end
- until wr <= 0
- repeat
- back()
- rex()
- until x == 0
- x = 0
- turnLeft()
- until z == d*1
- repeat
- back()
- rez()
- until z == 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement