Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - --Hollow Simple Script v1
 - --Turtle Program Computer Craft
 - --by SemlerPDX(July2021)
 - --pastebin get BfnmYS5q Hollow
 - --COMMENT SYNTAX EXPLAINATION
 - --torches must be in slot 1 (one for every 8th block, every 5th row)
 - --example: Hollow 22 31 (makes empty room 22 blocks deep and 31 blocks wide, with full torch coverage)
 - -- Variables --
 - local args = {...}
 - local d = args[1] or 0
 - local w = args[2] or 0
 - local r = 0 + d
 - local dLit = 4
 - local wLit = 0
 - local t = turtle
 - -- F-ACK --
 - if #args ~= 2 then
 - print("<error420: syntax>")
 - print("<ex: Hollow 20 10 (starts digging hollow 20 blocks deep and 10 blocks wide)>")
 - return
 - end
 - if d == 0 then
 - print("<error421: missing depth>")
 - print("<ex: Hollow 20 10 (starts digging hollow 20 blocks deep and 10 blocks wide)>")
 - return
 - end
 - --if d <= 6 then
 - -- print("<error421: depth too small>")
 - -- print("<ex: Hollow 10 10 (starts digging hollow 10 blocks deep and 10 blocks wide)>")
 - -- return
 - --end
 - -- Functions --
 - --force forward function by CCCode
 - local function forceForward()
 - while not t.forward() do
 - t.dig()
 - end
 - end
 - --dig down, decrement lit variable
 - local function fDown()
 - t.digDown()
 - t.down()
 - end
 - --dig up, turn around
 - local function fUp()
 - t.digUp()
 - t.up()
 - end
 - local function fRow()
 - fUp()
 - fUp()
 - for v=1,3 do
 - for s=1,d do
 - if v == 3 then
 - if dLit == 0 and wLit == 0 then
 - dLit = 8
 - fUp()
 - t.placeDown()
 - forceForward()
 - fDown()
 - else
 - forceForward()
 - end
 - if wLit == 0 then
 - dLit = dLit - 1
 - end
 - else
 - forceForward()
 - end
 - end
 - if v ~= 3 then
 - t.turnLeft()
 - t.turnLeft()
 - fDown()
 - end
 - end
 - end
 - local function fTurn()
 - t.turnLeft()
 - forceForward()
 - t.turnLeft()
 - end
 - --return home
 - local function fHome()
 - fUp()
 - t.turnLeft()
 - t.turnLeft()
 - r = 0 + d
 - while r ~=0 do
 - forceForward()
 - r = r -1
 - end
 - fDown()
 - end
 - --clear display screen
 - local function fset()
 - term.clear()
 - term.setCursorPos(1,1)
 - end
 - -- Pre-fire scripts --
 - fset()
 - print("Beginning Hollow "..tostring(d).." blocks deep and "..tostring(w).." blocks wide...")
 - sleep(1)
 - print(" -press any key to cancel-")
 - sleep(2)
 - ---- Main Loop ----
 - while w ~= 0 do
 - local function fcancel()
 - local event, key = os.pullEvent("key")
 - end
 - local function fmain()
 - fRow()
 - fHome()
 - fTurn()
 - w = w - 1
 - if wLit == 0 then
 - wLit = 5
 - end
 - wLit = wLit - 1
 - dLit = 4
 - end
 - FunctionEnabled = parallel.waitForAny(fcancel,fmain)
 - if FunctionEnabled == 1 then
 - textutils.slowPrint("Cancelling Hollow...", 15)
 - sleep(1.65)
 - break
 - end
 - end
 - -- Evaluate Ending --
 - if FunctionEnabled == 1 then --(1 = functions cancelled, 2 = standard function looped)
 - fset()
 - print("Hollow Cancelled by user")
 - else
 - fset()
 - print("Hollow "..tostring(args[1]).." "..tostring(args[2]).." Finished")
 - fset()
 - print("...program complete")
 - end
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment