Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------
- ---- DESCRIPTION ----------------------
- ---------------------------------------
- -- One turtle builds a mansion.
- -- Details see information during program
- -- execution or YouTube video.
- ---------------------------------------
- ---- PARAMETERS -----------------------
- ---------------------------------------
- local cVersion ="v1.00"
- local cMinFuel =128
- ---------------------------------------
- ---- VARIABLES ------------------------
- ---------------------------------------
- local blnAskForParameters = true
- local blnShowUsage = false
- ---------------------------------------
- ---- tArgs ----------------------------
- ---------------------------------------
- local tArgs = {...}
- if #tArgs == 1 then -- no error check
- blnAskForParameters=false
- if tArgs[1]=="help" then blnShowUsage=true end
- -- any other parameter will start program
- end
- if blnShowUsage then
- print("Usage: bMansion [anyParameter]")
- print("If anyParameter exists, then the program")
- print(" starts without need to press a key.")
- print("If anyParameter is 'help', then this")
- print(" info is displayed.")
- return
- end
- ---------------------------------------
- -- BASIC FUNCTIONS FOR TURTLE CONTROL -
- ---------------------------------------
- local function gf(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.forward() do end end
- end
- local function gb(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.back() do end end
- end
- local function gu(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.up() do end end
- end
- local function gd(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.down() do end end
- end
- local function gl(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.turnLeft() do end end
- end
- local function gr(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.turnRight() do end end
- end
- local function pf(n)
- -- moves backwards if n>1
- if n==nil then n=1 end
- for i=1,n,1 do if i~=1 then gb() end turtle.place() end
- end
- local function pu() turtle.placeUp() end
- local function pd() turtle.placeDown() end
- local function df() turtle.dig() end
- local function du() turtle.digUp() end
- local function dd() turtle.digDown() end
- local function sf() turtle.suck() end
- local function su() turtle.suckUp() end
- local function sd() turtle.suckDown() end
- local function Df() turtle.drop() end
- local function Du() turtle.dropUp() end
- local function Dd() turtle.dropDown() end
- local function ss(s) turtle.select(s) end
- local function askForInputText(textt)
- local at=""
- -- check prompting texts
- if textt==nil then textt="Enter text:" end
- -- ask for input
- write(textt)
- at=read()
- return at
- end
- local function checkFuel()
- local tmp=turtle.getFuelLevel()
- return tmp
- end
- ------------------------------------------------------------------------------
- ---- MAIN --------------------------------------------------------------------
- ------------------------------------------------------------------------------
- -- step 0 usage hints
- if blnAskForParameters then
- term.clear() term.setCursorPos(1,1)
- repeat
- print("+-------------------------------------+")
- print("| Put in turtle slots these materials:|")
- print("| 1: 44 mk2 energy condensers |")
- print("| 2: 12 red matter relays |")
- print("| 3: 8 grey glass |")
- print("| 4: 8 green glass |")
- print("| 5: 8 magenta glass |")
- print("| 6: 8 red glass |")
- print("| 7: 4 energy condensers |")
- print("+-------------------------------------+")
- until askForInputText("Press enter for next page:")==""
- term.clear() term.setCursorPos(1,1)
- repeat
- print("+-------------------------------------+")
- print("| Put in turtle slots these materials:|")
- print("| 8: 4 filters |")
- print("| 9: 17 pneumatic tubes |")
- print("| 10: 29 stone covers |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("+-------------------------------------+")
- until askForInputText("Press enter for next page:")==""
- term.clear() term.setCursorPos(1,1)
- repeat
- print("+-------------------------------------+")
- print("| Additional items needed to complete:|")
- print("| 4 mk2 energy condensers |")
- print("| 4 red matter relays |")
- print("| 4 stone covers |")
- print("| 17 red alloy wires |")
- print("| wrench |")
- print("| |")
- print("| |")
- print("| |")
- print("+-------------------------------------+")
- until askForInputText("Press enter to start:")==""
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement