Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Room rewrite
- --Is interactive, run with just 'room' for prompts.
- --Rednet Logging
- --Digs 3 rows at a time, wherever possible.
- --Dumps to return-chest OR EnderChest.
- --Places slabs if set on bottom AND/OR top
- --Can Run from Left or Right Corner
- --Can Run from Middle (left or right of even)
- --Can Run Inverted (Down)
- --Can return a one-line command
- --eventhorizoncomputer?other bad coputersscifi
- -- Rednet Channels:
- -- 9997 - All Action Logging
- -- 8089 - Master Action Logging
- -- 666 - Master Command Channel
- -- 69 - Turtle-Interlink Channel
- -- 420 - Farm Broadcasts
- -- 17 - Quote of the Day
- -- 43 - WhoIs
- -- - FuelLevel
- -- - Inventory Count, Type, table?
- -- Rednet Variables
- -- host - systemname
- -- loc - GPS location
- -- Mod - hasmodem t/f
- --Arguments for location and etc.
- -- x - Direction directly away
- -- y - Direction Left/Right
- -- z - Direction Up/Down
- -- - - Starting Corner (Just L/R to start; middle squares in v.9000)
- -- - - FloorBottom Slab
- -- - - FloorTop Slab
- -- - - Direction (inversion?)
- -- - - Chest (reg,ender,none)
- -- Start modem & announce self on network.
- -- Check GPS Location
- -- No GPS == set local location
- --Move the turtle forward, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveForward()
- if not turtle.forward() then
- if turtle.detect() then
- if not turtle.dig() then
- print("dig returning false after detect")
- return false
- else
- if turtle.forward() == true then
- return true
- else
- return moveForward()
- end
- end
- else
- while turtle.attack() do
- turtle.suck()
- print("Turtle is attacking")
- end
- if turtle.forward() == true then
- return true
- else
- return moveForward()
- end
- end
- else
- return true
- end
- end
- --Move the turtle down, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveDown()
- if not turtle.down() then
- if turtle.detectDown() then
- if not turtle.digDown() then
- print("dig down returning false after detect")
- return false
- else
- turtle.down()
- return true
- end
- else
- attack = True
- while turtle.attackDown() do
- turtle.suckDown()
- turtle.attackDown()
- turtle.suckDown()
- end
- turtle.down()
- return true
- end
- else
- return true
- end
- end
- --Move the turtle up, make sure the turtle actually moves into a free space before moving, attempt to pick up things if attack triggered.
- --Rednet(9997)
- function moveUp()
- if not turtle.up() then
- if turtle.detectUp() then
- if not turtle.digUp() then
- print("dig up returning false after detect")
- return false
- else
- turtle.up()
- return true
- end
- else
- attack = True
- while turtle.attackUp() do
- turtle.suckUp()
- turtle.attackUp()
- turtle.suckUp()
- end
- turtle.up()
- return true
- end
- else
- return true
- end
- end
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- --------Time to merge floor and room logic for NEWROOMDIG----------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- --Arguments for location and etc.
- -- Mx - Direction directly away
- -- My - Direction Left/Right
- -- Mz - Direction Up/Down
- -- Ms - Starting Corner (Just L/R to start; middle squares in v.9000)
- -- Sb - FloorBottom Slab
- -- St - FloorTop Slab
- -- Mq - Direction (inversion?)
- -- Mc - Chest (reg,ender,none)
- MYx=0
- MYy=0
- MYz=0
- MYs = null
- Sb=0
- St=0
- Mq = null
- Mc = null
- direction = true
- interactive = "blarg"
- local tArgs = {...}
- --Interactive mode if the flags aren't what is expected.
- --Task:Optional Parameters? Presets? Logic to set (if only x, y = x, z= x, etc)
- if #tArgs ~= 8 then
- print("\n Arguments are invalid.\n\n Starting in your face interface.")
- --Set Myx
- while MYx==0 do
- print("Input X, directly away.")
- n = tonumber(read())
- MYx = n
- if type(n) == "number" then
- print("X has been set to"..MYx)
- end
- end
- --Set MYy
- while MYy==0 do
- print("Input Y, direction left/right.")
- n = tonumber(read())
- MYy = n
- if type(n) == "number" then
- print("Y has been set to"..MYy)
- end
- end
- --Set MYz
- while MYz==0 do
- print("Input Z, direction up/down/")
- n = tonumber(read())
- MYz = n
- if type(n) == "number" then
- print("Z has been set to"..MYz)
- end
- end
- --Set MYs
- while MYs==null do
- print("Build Left or Right?")
- n = tonumber(read())
- MYs = n
- if type(n) == "number" then
- print("Starting corner has been set to"..MYs)
- end
- end
- --Set Sb
- while Sb==0 do
- print("Build slab floor?")
- n = tonumber(read())
- Sb = n
- if type(n) == "number" then
- print("Slab floor has been set to"..Sb)
- end
- end
- --Set St
- while St==0 do
- print("Build slab roof?")
- n = tonumber(read())
- St = n
- if type(n) == "number" then
- print("Slab floor has been set to"..St)
- end
- end
- --Set Mq
- while Mq==null do
- print("Room (up) or Excavate (down)?")
- n = tonumber(read())
- Mq = n
- if type(n) == "number" then
- print("Room/Excavate has been set to"..Mq)
- end
- end
- --Set Mc
- while Mc==null do
- print("Am I using a chest?")
- n = tonumber(read())
- Mc = n
- if type(n) == "number" then
- print("Chest value has been set to"..Mc)
- end
- end
- print("Your combination should be:")
- print("room "..MYx.." "..MYy.." "..MYz.." "..MYs.." "..Sb.." "..St.." "..Mq.." "..Mc)
- --Check fuel before continueing
- local fuel = turtle.getFuelLevel()
- local roomSize = MYx * MYy * MYz
- print(roomSize)
- while fuel < roomSize do
- if not turtle.refuel(1) then
- print("Not enough fuel")
- return
- end
- end
- --shell.run(thestring)
- print("Would you like to run now?")
- repeat
- event , param1 = os.pullEvent("char")
- if param1 == "y" then
- --RUNIT
- print("Running room program!")
- return
- elseif param1 == "n" then
- print("Ending.")
- return
- elseif param1 ~= ("y"or"a") then
- print ("wrong key")
- end
- until interactive ~= "blarg"
- end
- local MYx = tonumber(tArgs[1]) - 1
- local MYy = tonumber(tArgs[2])
- local MYz = tonumber(tArgs[3])
- local MYs = tonumber(tArgs[4])
- local Sb = tonumber(tArgs[5])
- local St = tonumber(tArgs[6])
- local Mq = tonumber(tArgs[7])
- local Mc = tonumber(tArgs[8])
- local direction = true
- for i=1, #tArgs do
- print(tArgs[i])
- end
- --originalroomdig
- --local tArgs = {...}
- -- if #tArgs ~= 3 then
- -- print("Requires length, width, height")
- -- return
- -- end
- --
- -- local x = tonumber(tArgs[1]) - 1
- -- local y = tonumber(tArgs[2])
- -- local z = tonumber(tArgs[3])
- --
- -- if x == nil or y == nil or z == nil then
- -- print("Invalid dimensions")
- -- return
- -- end
- --
- -- if x < 0 or y < 0 or z < 0 then
- -- print("Invalid (negative) dimensions")
- -- return
- -- end
- --
- --
- --
- -- local fuel = turtle.getFuelLevel()
- -- local roomSize = x * y * z
- -- while fuel < roomSize do
- -- if not turtle.refuel(1) then
- -- print("Not enough fuel")
- -- return
- -- end
- -- end
- --
- --
- --
- -- local direction = true
- -- for i = 1, z do
- -- for j = 1, y do
- -- for k = 1, x do
- -- moveForward()
- -- end
- -- if j < y then
- -- if direction then
- -- turtle.turnRight()
- -- moveForward()
- -- turtle.turnRight()
- -- direction = false
- -- else
- -- turtle.turnLeft()
- -- moveForward()
- -- turtle.turnLeft()
- -- direction = true
- -- end
- -- end
- -- end
- -- if i < z then
- -- moveUp()
- -- turtle.turnRight()
- -- turtle.turnRight()
- -- end
- -- end
- --
- -- if y % 2 == 0 then
- -- turtle.turnRight()
- -- for i = 1, y do
- -- turtle.forward()
- -- end
- -- turtle.turnRight()
- -- else
- -- turtle.turnLeft()
- -- for i = 1, y do
- -- turtle.forward()
- -- end
- -- turtle.turnLeft()
- -- for i = 1, x do
- -- turtle.forward()
- -- end
- -- turtle.turnRight()
- -- turtle.turnRight()
- -- end
- -- for i = 1, z do
- -- turtle.down()
- -- end
Add Comment
Please, Sign In to add comment