Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Minecraft 1.16.5
- -- Forge 36.1.66
- -- Mod: cc-tweaked-1.16.4-1.96.0.jar
- local file = fs.exists("/Log.txt")
- if file then
- fs.delete("/Log.txt")
- end
- local System = os -- Used for System things like os.time() to System.time()
- local Screen = term -- Used for Screen thing on the turtle or computer like term.clear() to Screen.clear()
- local Per = peripheral -- Used shortcut for peripheral
- local Text = textutils -- Used shortcut for textilils
- local Pack = Text.serialize -- Makes a new command for packing ( shortcut used from local Text)
- local UnPack = Text.unserialize -- Makes a new command for unpacking ( shortcut used from local Text)
- local oldTurtle = turtle
- local Monitor = {}
- Monitor[0] = Screen -- sets Monitor[0] to term
- local Status = 1
- local Sand = {}
- Sand.found = false
- local Water = {}
- Water.found = false
- local Mine = {}
- Mine.found = false
- local chestSlot, bucketSlot, modemSlot = 16, 14, 15
- local w, h = Monitor[0].getSize()
- local Tools = {"computercraft:wireless_modem", "minecraft:diamond_pickaxe", "minecraft:crafting_table"}
- local Toolequip = turtle.equipRight
- local EquipLeft = false
- local EquipRight = false
- local Chests = {[1] = {name = "rest"}, [2] = {name = "wood"}, [3] = {name = "stone"}, [4] = {name = "sand"}, [5] = {name = "redstone"}, [6] = {name = "iron"}, [7] = {name = "coal"}, [8] = {name = "diamond"}, [9] = {name = "sapling"}}
- function SaveFile(File, Data, Do30)
- if File == "log" then
- local file = fs.exists("/Log.txt")
- if file then
- file = fs.open("/Log.txt", "a")
- else
- file = fs.open("/Log.txt", "w")
- end
- file.writeLine(Data)
- file.close()
- if Do30 == true then
- print(Data)
- end
- elseif File == "status" then
- file = fs.open("/.Status.st", "w")
- file.write(Status)
- file.close()
- SaveFile("log", "Status Saved: "..Status, true)
- elseif File == "locations" then
- local Data = {Sand = Sand, Water = Water, Mine = Mine, Lava = T:getLava()}
- file = fs.open("/.Locations.lo", "w")
- file.write(Pack(Data))
- file.close()
- SaveFile("log", "Locations Saved", true)
- elseif File == "chests" then
- file = fs.open("/.Chests.ch", "w")
- file.write(Pack(Chests))
- file.close()
- SaveFile("log", "Locations Saved", true)
- end
- end
- SaveFile("log", "Starting...", true)
- if not System.getComputerLabel() then
- local id = System.getComputerID()
- local name = "MineBot"
- System.setComputerLabel(name)
- local test = tonumber(string.sub (name, string.len(name), string.len(name)))
- if type(test) ~= "number" then
- name = name.." ID: "..id
- System.setComputerLabel(name)
- end
- SaveFile("log", "Setting Computer Label to: "..name, true)
- SaveFile("log", "Computer Label: "..name, true)
- print(System.getComputerLabel())
- else
- local name = System.getComputerLabel()
- local id = System.getComputerID()
- local test = tonumber(string.sub (name, string.len(name) , string.len(name)))
- if type(test) ~= "number" then
- SaveFile("log", "Add Number to Computer Label: "..name, true)
- name = name.." ID: "..id
- SaveFile("log", "Setting Computer Label to: "..name, true)
- System.setComputerLabel(name)
- end
- SaveFile("log", "Computer Label: "..name, true)
- print(System.getComputerLabel())
- end
- function Turtle()
- clsTurtle = turtle -- the table representing the class, which will double as the metatable for any instances
- clsTurtle.__index = clsTurtle -- failed table lookups on the instances should fallback to the class table, to get methods
- local self = setmetatable({}, clsTurtle)
- self.X = 0
- self.Y = 0
- self.Z = 0
- self.R = 1
- self.HomeX = 0
- self.HomeY = 0
- self.HomeZ = 0
- self.HomeR = 1
- self.Lava = false
- self.Directions = {"North","East","South","West"}
- self.zDiff = {-1, 0, 1, 0} -- Differents between north and south on z ax
- self.xDiff = {0, 1, 0, -1} -- Differents between east and west om x ax
- function clsTurtle.getX(self) return self.X end
- function clsTurtle.getY(self) return self.Y end
- function clsTurtle.getZ(self) return self.Z end
- function clsTurtle.getR(self) return self.R end
- function clsTurtle.getHomeX(self) return self.HomeX end
- function clsTurtle.getHomeY(self) return self.HomeY end
- function clsTurtle.getHomeZ(self) return self.HomeZ end
- function clsTurtle.getHomeR(self) return self.HomeR end
- function clsTurtle.getLava(self) return self.Lava end
- function clsTurtle.setX(self, newVal) self.X = newVal end
- function clsTurtle.setY(self, newVal) self.Y = newVal end
- function clsTurtle.setZ(self, newVal) self.Z = newVal end
- function clsTurtle.setR(self, newVal) self.R = newVal end
- function clsTurtle.setHomeX(self, newVal) self.HomeX = newVal end
- function clsTurtle.setHomeY(self, newVal) self.HomeY = newVal end
- function clsTurtle.setHomeZ(self, newVal) self.HomeZ = newVal end
- function clsTurtle.setHomeR(self, newVal) self.HomeR = newVal end
- function clsTurtle.setLava(self, newVal) self.Lava = newVal end
- function clsTurtle.Add(self, to, value)
- to = to + value
- return to
- end
- function clsTurtle.Sub(self, to, value)
- to = to - value
- return to
- end
- function clsTurtle.emptyInv(self)
- for i = 1, 2 do
- clsTurtle.Forward(self)
- end
- SaveFile("log", "Dropping items", true)
- for i = 1, 16 do
- if clsTurtle.getItemDetail(i) ~= nil and not(string.find(clsTurtle.getItemDetail(i).name, "chest")) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- end
- end
- for i = 1, 15 do
- if clsTurtle.getItemDetail(i) ~= nil and string.find(clsTurtle.getItemDetail(i).name, "chest") then
- clsTurtle.select(i)
- clsTurtle.transferTo(chestSlot, 1)
- end
- end
- for i = 1, 15 do
- clsTurtle.select(i)
- clsTurtle.dropDown()
- end
- for i = 1, 2 do
- clsTurtle.Back(self)
- end
- end
- function clsTurtle.findChest(self, name)
- for i = 1, #Chests do
- if Chests[i].name == name then
- return i
- end
- end
- return false
- end
- function clsTurtle.checkUp(self)
- local succes, Detials = clsTurtle.inspectUp()
- if succes then
- clsTurtle.digUp()
- clsTurtle.Up(self)
- clsTurtle.checkUp(self)
- clsTurtle.Down(self)
- end
- end
- function clsTurtle.Refuel(self)
- if clsTurtle.getFuelLevel() < 1000 then
- local filled = {}
- local number = clsTurtle.findChest(self, "coal")
- if number then
- clsTurtle.GoTo(self, Chests[number])
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- local count1, slots1 = clsTurtle.LookInvItems(self, "minecraft:coal", false)
- if #slots1 > 0 then
- for a = 1, 16 do
- details = clsTurtle.getItemDetail(a)
- if details and details.name ~= "minecraft:coal" then
- clsTurtle.select(a)
- clsTurtle.dropDown()
- end
- end
- if count1 >= 9 then
- local T1 = 16
- for b = 1, #slots1 do
- clsTurtle.select(slots1[b])
- clsTurtle.transferTo(T1,64)
- T1 = clsTurtle.Sub(self, T1, 1)
- end
- count1, slots1 = clsTurtle.LookInvItems(self, "minecraft:coal", false)
- local C = {}
- for b = 1, #slots1 do
- C[b] = {}
- C[b].slot = slots1[b]
- C[b].count = clsTurtle.getItemCount(C[b].slot)
- end
- for b = 1, #C do
- clsTurtle.select(C[b].slot)
- if C[b].count >= 9 then
- N = math.floor(C[b].count / 9)
- for z = 1,3 do clsTurtle.transferTo(z,N) end
- for z = 5,7 do clsTurtle.transferTo(z,N) end
- for z = 9,11 do clsTurtle.transferTo(z,N) end
- end
- clsTurtle.dropDown()
- end
- clsTurtle.craft()
- else
- for a = 1, 16 do
- details = clsTurtle.getItemDetail(a)
- if details and details.name == "minecraft:coal" then
- clsTurtle.select(a)
- clsTurtle.dropDown()
- end
- end
- end
- end
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- local count1, slots1 = clsTurtle.LookInvItems(self, "minecraft:charcoal", false)
- if #slots1 > 0 then
- for a = 1, 16 do
- details = clsTurtle.getItemDetail(a)
- if details and details.name ~= "minecraft:charcoal" then
- clsTurtle.select(a)
- clsTurtle.dropDown()
- end
- end
- if count1 >= 9 then
- local T1 = 16
- for b = 1, #slots1 do
- clsTurtle.select(slots1[b])
- clsTurtle.transferTo(T1,64)
- T1 = clsTurtle.Sub(self, T1, 1)
- end
- count1, slots1 = clsTurtle.LookInvItems(self, "minecraft:charcoal", false)
- local C = {}
- for b = 1, #slots1 do
- C[b] = {}
- C[b].slot = slots1[b]
- C[b].count = clsTurtle.getItemCount(C[b].slot)
- end
- for b = 1, #C do
- clsTurtle.select(C[b].slot)
- if C[b].count >= 9 then
- N = math.floor(C[b].count / 9)
- for z = 1,3 do clsTurtle.transferTo(z,N) end
- for z = 5,7 do clsTurtle.transferTo(z,N) end
- for z = 9,11 do clsTurtle.transferTo(z,N) end
- end
- clsTurtle.dropDown()
- end
- clsTurtle.craft()
- else
- for a = 1, 16 do
- details = clsTurtle.getItemDetail(a)
- if details and details.name == "minecraft:charcoal" then
- clsTurtle.select(a)
- clsTurtle.dropDown()
- end
- end
- end
- end
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and details.name ~= Tools[4] and not(string.find(details.name, "chest")) and not(string.find(details.name, "sapling")) then
- clsTurtle.select(i)
- local Fill = clsTurtle.refuel()
- table.insert(filled, Fill)
- end
- end
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and string.find(details.name, "chest") then
- clsTurtle.select(i)
- clsTurtle.transferTo(chestSlot, 1)
- elseif details and string.find(details.name, "bucket") then
- clsTurtle.select(i)
- clsTurtle.transferTo(bucketSlot, 1)
- elseif details and string.find(details.name, "modem") then
- clsTurtle.select(i)
- clsTurtle.transferTo(modemSlot, 1)
- elseif details and details.name ~= Tools[4] and not(string.find(details.name, "modem")) and not(string.find(details.name, "chest")) and not(string.find(details.name, "bucket")) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- end
- end
- clsTurtle.select(1)
- clsTurtle.GoTo(self, clsTurtle.getHomeX(self), clsTurtle.getHomeY(self), clsTurtle.getHomeZ(self))
- clsTurtle.TurnDirection(self, clsTurtle.getHomeR(self))
- end
- local F1 = {}
- F1[1] = false
- for i = 1, #filled do
- if filled[i] then
- F1[1] = true
- end
- end
- if not(F1[1]) then
- filled = {}
- local number = clsTurtle.findChest(self, "wood")
- if number then
- clsTurtle.GoTo(self, Chests[number])
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and details.name ~= Tools[4] and not(string.find(details.name, "chest")) and not(string.find(details.name, "sapling")) then
- clsTurtle.select(i)
- local Fill = clsTurtle.refuel()
- table.insert(filled, Fill)
- end
- end
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and details.name ~= Tools[4] and not(string.find(details.name, "chest")) and not(string.find(details.name, "bucket")) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- elseif details and string.find(details.name, "chest") then
- clsTurtle.select(i)
- clsTurtle.transferTo(chestSlot, 1)
- elseif details and string.find(details.name, "bucket") then
- clsTurtle.select(i)
- clsTurtle.transferTo(bucketSlot, 1)
- elseif details and string.find(details.name, "modem") then
- clsTurtle.select(i)
- clsTurtle.transferTo(modemSlot, 1)
- end
- end
- end
- clsTurtle.select(1)
- clsTurtle.GoTo(self, clsTurtle.getHomeX(self), clsTurtle.getHomeY(self), clsTurtle.getHomeZ(self))
- clsTurtle.TurnDirection(self, clsTurtle.getHomeR(self))
- end
- F1[2] = false
- for i = 1, #filled do
- if filled[i] then
- F1[2] = true
- end
- end
- if not(F1[2]) and Status > 7 then
- filled = {}
- HarvestTreeFarm()
- local number = clsTurtle.findChest(self, "wood")
- if number then
- clsTurtle.GoTo(self, Chests[number])
- clsTurtle.select(1)
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and details.name ~= Tools[4] and not(string.find(details.name, "chest")) and not(string.find(details.name, "sapling")) then
- clsTurtle.select(i)
- local Fill = clsTurtle.refuel()
- table.insert(filled, Fill)
- end
- end
- while clsTurtle.suckDown() do end
- for i = 1, 16 do
- local details = clsTurtle.getItemDetail(i)
- if details and details.name ~= Tools[4] and not(string.find(details.name, "chest")) and not(string.find(details.name, "bucket")) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- elseif details and string.find(details.name, "chest") then
- clsTurtle.select(i)
- clsTurtle.transferTo(chestSlot, 1)
- elseif details and string.find(details.name, "bucket") then
- clsTurtle.select(i)
- clsTurtle.transferTo(bucketSlot, 1)
- elseif details and string.find(details.name, "modem") then
- clsTurtle.select(i)
- clsTurtle.transferTo(modemSlot, 1)
- end
- end
- end
- clsTurtle.select(1)
- clsTurtle.GoTo(self, clsTurtle.getHomeX(self), clsTurtle.getHomeY(self), clsTurtle.getHomeZ(self))
- clsTurtle.TurnDirection(self, clsTurtle.getHomeR(self))
- end
- F1[3] = false
- for i = 1, #filled do
- if filled[i] then
- F1[3] = true
- end
- end
- local F = false
- for i = 1, #F1 do
- if F1[i] then
- F = true
- end
- end
- return F
- else
- return false
- end
- end
- function clsTurtle.Forward(self)
- local Moved = clsTurtle.forward()
- if Moved then
- clsTurtle.setX(self, clsTurtle.getX(self) + self.xDiff[clsTurtle.getR(self)])
- clsTurtle.setZ(self, clsTurtle.getZ(self) + self.zDiff[clsTurtle.getR(self)])
- end
- return Moved
- end
- function clsTurtle.Back(self)
- local Moved = clsTurtle.back()
- if Moved then
- clsTurtle.setX(self, clsTurtle.getX(self) - self.xDiff[clsTurtle.getR(self)])
- clsTurtle.setZ(self, clsTurtle.getZ(self) - self.zDiff[clsTurtle.getR(self)])
- end
- return Moved
- end
- function clsTurtle.Up(self)
- local Moved = clsTurtle.up()
- if Moved then
- clsTurtle.setY(self, clsTurtle.getY(self) + 1)
- end
- return Moved
- end
- function clsTurtle.Down(self)
- local Moved = clsTurtle.down()
- if Moved then
- clsTurtle.setY(self, clsTurtle.getY(self) - 1)
- end
- return Moved
- end
- function clsTurtle.TurnDirection(self, O)
- SaveFile("log", "turn to: "..O.." = "..self.Directions[O], true)
- while clsTurtle.getR(self) ~= O do
- clsTurtle.TurnLeft(self)
- end
- end
- function clsTurtle.TurnLeft(self)
- local Ro = (clsTurtle.getR(self) - 1)
- Ro = (Ro - 1) % 4
- clsTurtle.setR(self, (Ro + 1))
- clsTurtle.turnLeft()
- end
- function clsTurtle.TurnRight(self)
- local Ro = (clsTurtle.getR(self) - 1)
- Ro = (Ro + 1) % 4
- clsTurtle.setR(self, (Ro + 1))
- clsTurtle.turnRight()
- end
- function clsTurtle.GoTo(self, GX, GY, GZ)
- if type(GX) == "table" then
- GZ = GX.Z
- GY = GX.Y
- GX = GX.X
- end
- SaveFile("log", "GoTo: X: "..GX.." Y: "..GY.." Z: "..GZ, true)
- if clsTurtle.getFuelLevel() < 500 then
- clsTurtle.Refuel(self)
- end
- while clsTurtle.getY(self) < GY and not(clsTurtle.detectUp()) do
- clsTurtle.Up(self)
- end
- while clsTurtle.getY(self) > GY and not(clsTurtle.detectDown()) do
- clsTurtle.Down(self)
- end
- if clsTurtle.getX(self) < GX then
- clsTurtle.TurnDirection(self, 2)
- while clsTurtle.getX(self) < GX do
- if not(clsTurtle.Forward(self)) then break end
- end
- end
- if clsTurtle.getX(self) > GX then
- clsTurtle.TurnDirection(self, 4)
- while clsTurtle.getX(self) > GX do
- if not(clsTurtle.Forward(self)) then break end
- end
- end
- if clsTurtle.getZ(self) < GZ then
- clsTurtle.TurnDirection(self, 3)
- while clsTurtle.getZ(self) < GZ do
- if not(clsTurtle.Forward(self)) then break end
- end
- end
- if clsTurtle.getZ(self) > GZ then
- clsTurtle.TurnDirection(self, 1)
- while clsTurtle.getZ(self) > GZ do
- if not(clsTurtle.Forward(self)) then break end
- end
- end
- while clsTurtle.getY(self) < GY and not(clsTurtle.detectUp()) do
- clsTurtle.Up(self)
- end
- while clsTurtle.getY(self) > GY and not(clsTurtle.detectDown()) do
- clsTurtle.Down(self)
- end
- end
- function clsTurtle.GoHome(self)
- SaveFile("log", "Going home", true)
- while clsTurtle.getY(self) < 100 do
- while clsTurtle.detectUp() do
- while clsTurtle.detect() do
- clsTurtle.TurnLeft(self)
- end
- clsTurtle.Forward(self)
- end
- clsTurtle.Up(self)
- end
- while clsTurtle.getY(self) > 100 do
- clsTurtle.Down(self)
- end
- if clsTurtle.getX(self) < clsTurtle.getHomeX(self) then
- clsTurtle.TurnDirection(self, 2)
- while clsTurtle.getX(self) < clsTurtle.getHomeX(self) do
- clsTurtle.Forward(self)
- end
- end
- if clsTurtle.getX(self) > clsTurtle.getHomeX(self) then
- clsTurtle.TurnDirection(self, 4)
- while clsTurtle.getX(self) > clsTurtle.getHomeX(self) do
- clsTurtle.Forward(self)
- end
- end
- if clsTurtle.getZ(self) < clsTurtle.getHomeZ(self) then
- clsTurtle.TurnDirection(self, 3)
- while clsTurtle.getZ(self) < clsTurtle.getHomeZ(self) do
- clsTurtle.Forward(self)
- end
- end
- if clsTurtle.getZ(self) > clsTurtle.getHomeZ(self) then
- clsTurtle.TurnDirection(self, 1)
- while clsTurtle.getZ(self) > clsTurtle.getHomeZ(self) do
- clsTurtle.Forward(self)
- end
- end
- while clsTurtle.getY(self) < clsTurtle.getHomeY(self) do
- clsTurtle.Up(self)
- end
- while clsTurtle.getY(self) > clsTurtle.getHomeY(self) do
- clsTurtle.Down(self)
- end
- clsTurtle.TurnDirection(self, clsTurtle.getHomeR(self))
- end
- function clsTurtle.Craft(self, tocraft, countt, resource)
- local count, slots = clsTurtle.LookInvItems(self, resource, true)
- for i = 1, 16 do
- local found = false
- for j = 1, #slots do
- if i == slots[j] then
- found = true
- end
- end
- if not(found) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- end
- end
- if #slots >= 2 then
- for i = 2, #slots do
- clsTurtle.select(slots[i])
- clsTurtle.dropDown()
- end
- end
- clsTurtle.select(slots[1])
- clsTurtle.transferTo(4)
- clsTurtle.select(4)
- if tocraft == "planks" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= math.ceil(countt / 4) then
- local a = math.ceil(countt / 4)
- clsTurtle.transferTo(1, a)
- clsTurtle.dropDown()
- clsTurtle.craft(a)
- end
- elseif tocraft == "bone_meal" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= math.ceil(countt / 3) then
- local a = math.ceil(countt / 3)
- clsTurtle.transferTo(1, a)
- clsTurtle.dropDown()
- clsTurtle.craft(a)
- end
- elseif tocraft == "white_dye" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= countt then
- clsTurtle.transferTo(1, countt)
- clsTurtle.dropDown()
- clsTurtle.craft(countt)
- end
- elseif tocraft == "stick" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= math.ceil(countt / 4) * 2 then
- local a = math.ceil(countt / 4)
- clsTurtle.transferTo(1, a)
- clsTurtle.transferTo(5, a)
- clsTurtle.dropDown()
- clsTurtle.craft(a)
- end
- elseif tocraft == "paper" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= math.ceil(countt) then
- local a = math.ceil(countt / 3)
- clsTurtle.transferTo(1, a)
- clsTurtle.transferTo(2, a)
- clsTurtle.transferTo(3, a)
- clsTurtle.dropDown()
- clsTurtle.craft(a)
- end
- elseif tocraft == "chest" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= countt * 8 then
- clsTurtle.transferTo(1, countt)
- clsTurtle.transferTo(2, countt)
- clsTurtle.transferTo(3, countt)
- clsTurtle.transferTo(5, countt)
- clsTurtle.transferTo(7, countt)
- clsTurtle.transferTo(9, countt)
- clsTurtle.transferTo(10, countt)
- clsTurtle.transferTo(11, countt)
- clsTurtle.dropDown()
- clsTurtle.craft(countt)
- end
- elseif tocraft == "furnace" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= countt * 8 then
- clsTurtle.transferTo(1, countt)
- clsTurtle.transferTo(2, countt)
- clsTurtle.transferTo(3, countt)
- clsTurtle.transferTo(5, countt)
- clsTurtle.transferTo(7, countt)
- clsTurtle.transferTo(9, countt)
- clsTurtle.transferTo(10, countt)
- clsTurtle.transferTo(11, countt)
- clsTurtle.dropDown()
- clsTurtle.craft(countt)
- end
- elseif tocraft == "bucket" then
- local details = clsTurtle.getItemDetail(4)
- if details.count >= countt * 3 then
- clsTurtle.transferTo(1, countt)
- clsTurtle.transferTo(3, countt)
- clsTurtle.transferTo(6, countt)
- clsTurtle.dropDown()
- clsTurtle.craft(countt)
- end
- elseif tocraft == "ladder" then
- local details = clsTurtle.getItemDetail(4)
- local N = math.ceil(countt / 3)
- if details.count >= math.ceil(N * 7) then
- clsTurtle.transferTo(1, N)
- clsTurtle.transferTo(3, N)
- clsTurtle.transferTo(5, N)
- clsTurtle.transferTo(6, N)
- clsTurtle.transferTo(7, N)
- clsTurtle.transferTo(9, N)
- clsTurtle.transferTo(11, N)
- clsTurtle.dropDown()
- clsTurtle.craft(N)
- end
- end
- end
- function clsTurtle.LookInvItems(self, name, Find)
- local Count, Slots = 0 , {}
- for i = 1, 16 do
- local Details = clsTurtle.getItemDetail(i)
- if Details then
- if Find == true then
- if string.find(Details.name, name) then
- Count = Count + Details.count
- table.insert(Slots, i)
- end
- elseif Find == false then
- if Details.name == name then
- Count = Count + Details.count
- table.insert(Slots, i)
- end
- end
- end
- end
- return Count, Slots
- end
- function clsTurtle.SortInvItems(self, number)
- local keep = {}
- if Status <= 4 then
- keep = {"coal","sand","redstone","dirt","torch","diamond","ore","iron","gold","log","sugar_cane","lapis","emerald","chest","modem","bucket","cobblestone","bone","crafting_table","sapling","seed"}
- else
- keep = {"coal","sand","redstone","torch","diamond","ore","iron","gold","log","sugar_cane","lapis","emerald","chest","modem","bucket","cobblestone","bone","crafting_table","sapling","seed"}
- end
- for I = 1, 16 do
- local details = clsTurtle.getItemDetail(I)
- if details then
- local found = false
- for A = 1, #keep do
- if string.find(details.name, keep[A]) then
- found = true
- local count, slots = clsTurtle.LookInvItems(self, details.name, false)
- local b = 1
- if #slots > 1 then
- for i = 2, #slots do
- if number == 1 then
- clsTurtle.select(slots[i])
- clsTurtle.transferTo(slots[b], 64)
- while clsTurtle.getItemCount(slots[b]) == 64 and b < 16 do
- if b < #slots then
- b = clsTurtle.Add(self, b, 1)
- end
- clsTurtle.transferTo(slots[b], 64)
- end
- elseif number == 2 then
- if string.find(details.name, "cobblestone") then
- clsTurtle.select(slots[i])
- clsTurtle.transferTo(slots[1], 64)
- clsTurtle.drop()
- else
- clsTurtle.select(slots[i])
- clsTurtle.transferTo(slots[b], 64)
- while clsTurtle.getItemCount(slots[b]) == 64 and b < 16 do
- if b < #slots then
- b = clsTurtle.Add(self, b, 1)
- end
- clsTurtle.transferTo(slots[b], 64)
- end
- end
- elseif number == 3 then
- clsTurtle.select(slots[i])
- clsTurtle.transferTo(slots[1], 64)
- clsTurtle.drop()
- end
- end
- else
- if string.find(details.name, "modem") and I ~= modemSlot then
- clsTurtle.select(I)
- clsTurtle.transferTo(modemSlot, 1)
- elseif string.find(details.name, "bucket") and I ~= bucketSlot then
- clsTurtle.select(I)
- clsTurtle.transferTo(bucketSlot, 1)
- elseif string.find(details.name, "chest") and I ~= chestSlot then
- clsTurtle.select(I)
- clsTurtle.transferTo(chestSlot, 1)
- end
- end
- end
- end
- if not(found) then
- clsTurtle.select(I)
- clsTurtle.drop()
- end
- end
- end
- clsTurtle.select(1)
- end
- function clsTurtle.GetItemFromChest(self, chest, item, count, slot, Find)
- if Find == nil then
- Find = true
- end
- local number, N
- if type(chest) == "string"then
- number = clsTurtle.findChest(self, chest)
- elseif type(chest) == "number" then
- number = chest
- end
- if number then
- GetChest()
- clsTurtle.GoTo(self, Chests[number])
- clsTurtle.select(chestSlot)
- local side = "top"
- if number == 1 then
- clsTurtle.place()
- side = "front"
- else
- clsTurtle.placeUp()
- side = "top"
- end
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- local haveitem = false
- _, slots = clsTurtle.LookInvItems(self, item, Find)
- local number1 = count
- if #slots > 0 then
- for i = 1, #slots do
- clsTurtle.select(slots[i])
- clsTurtle.dropDown()
- end
- end
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if Find and string.find(Details.name, item) and number1 > 0 then
- if Details.count < number1 then
- chest1.pushItems(side, i, Details.count)
- number1 = number1 - Details.count
- clsTurtle.select(slot)
- if number == 1 then
- clsTurtle.suck()
- else
- clsTurtle.suckUp()
- end
- elseif Details.count >= number1 then
- chest1.pushItems(side, i, number1)
- number1 = number1 - number1
- clsTurtle.select(slot)
- if number == 1 then
- clsTurtle.suck()
- else
- clsTurtle.suckUp()
- end
- end
- elseif not(Find) and Details.name == item and number1 > 0 then
- if Details.count < number1 then
- chest1.pushItems(side, i, Details.count)
- number1 = number1 - Details.count
- clsTurtle.select(slot)
- if number == 1 then
- clsTurtle.suck()
- else
- clsTurtle.suckUp()
- end
- elseif Details.count >= number1 then
- chest1.pushItems(side, i, number1)
- number1 = number1 - number1
- clsTurtle.select(slot)
- if number == 1 then
- clsTurtle.suck()
- else
- clsTurtle.suckUp()
- end
- end
- elseif number1 <= 0 then
- break
- end
- end
- end
- N = clsTurtle.getItemCount(slot)
- if N >= count then
- haveitem = true
- end
- if not(haveitem) then
- clsTurtle.dropDown()
- end
- clsTurtle.select(chestSlot)
- if number == 1 then
- clsTurtle.dig()
- else
- clsTurtle.digUp()
- end
- if not(haveitem) then
- SaveFile("log", "Cant find "..item, true)
- return false, "Cant find "..item, N
- else
- return true
- end
- else
- SaveFile("log", "Cant find chest for "..item, true)
- return false, "Cant find chest for "..item
- end
- end
- return self
- end
- local T = Turtle()
- local file = fs.exists("/API/Logo.lua")
- if not(file) then
- shell.run("pastebin get s3aBGUVr /API/Logo.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- end
- System.loadAPI("/API/Logo.lua")
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Looking for file...")) /2), (h-1))
- SaveFile("log", "Looking for files...", true)
- local file0 = fs.exists("/API/Functions.lua")
- local file1 = fs.exists("/API/Button.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- if not(file0) then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Downloading Function file...")) /2), (h-1))
- SaveFile("log", "Downloading Function file...", true)
- shell.run("pastebin get sujHjqXC /API/Functions.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- end
- if not(file1) then
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Downloading Button file...")) /2), (h-1))
- SaveFile("log", "Downloading Button file...", true)
- shell.run("pastebin get mKpxpWmZ /API/Button.lua")
- Monitor[0].setBackgroundColor(colors.black)
- Monitor[0].setTextColor(colors.white)
- sleep(1)
- end
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
- Monitor[0].setCursorPos(1, (h-1))
- Monitor[0].clearLine()
- Monitor[0].setBackgroundColor(colors.white)
- Monitor[0].setTextColor(colors.black)
- Monitor[0].setCursorPos(math.floor((w - string.len("Installing files...")) /2), (h-1))
- SaveFile("log", "Installing files...", true)
- System.loadAPI("/API/Functions.lua")
- System.loadAPI("/API/Button.lua")
- Button.setMonitor(false)
- Button.setColors(colors.blue, colors.white, colors.white, colors.blue)
- Functions.SetColors(Monitor[0], colors.black, colors.white)
- sleep(1)
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Sub", 1, 1)
- SaveFile("log", "Looking for Fuel", false)
- Monitor[0].write("Looking for Fuel ")
- T.select(1)
- if T.getFuelLevel() < 50 then
- local succes = {}
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, i, T.refuel())
- end
- T.select(1)
- local F = false
- for i = 1, #succes do
- if succes[i] then
- F = true
- end
- end
- if not(F) then
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- F = false
- for i = 1, #succes do
- if succes[i] then
- F = true
- end
- end
- if not(F) then
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- end
- print("V")
- else
- print("V")
- end
- SaveFile("log", "Loading Status", true)
- file = fs.exists("/.Status.st")
- if file then
- file = fs.open("/.Status.st", "r")
- Status = tonumber(file.readLine())
- file.close()
- else
- file = fs.open("/.Status.st", "w")
- file.write(Status)
- file.close()
- end
- SaveFile("log", "Loaded Status: "..Status, true)
- SaveFile("log", "Looking for Tools", false)
- Monitor[0].write("Looking for Tools ")
- if Status > 2 then
- for i = 1, 2 do
- T.forward()
- end
- T.select(10)
- T.equipLeft()
- T.select(11)
- Toolequip()
- T.select(1)
- local succes = T.suckDown()
- if succes then
- while T.suckDown() do end
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details then
- if string.find(details.name, Tools[1]) then
- T.select(i)
- Toolequip()
- elseif details.name == Tools[2] then
- T.select(i)
- equipLeft = T.equipLeft()
- end
- end
- end
- for i = 1, 16 do
- if T.getItemDetail(i) ~= nil and not(string.find(T.getItemDetail(i).name, "chest")) then
- T.select(i)
- T.dropDown()
- end
- end
- for i = 1, 14 do
- if T.getItemDetail(i) ~= nil and string.find(T.getItemDetail(i).name, "chest") then
- T.select(i)
- T.transferTo(chestSlot, 1)
- end
- end
- for i = 1, 14 do
- T.select(i)
- T.dropDown()
- end
- else
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details then
- for _, name in ipairs(Tools) do
- if details.name == name then
- if string.find(details.name, Tools[1]) then
- T.select(i)
- Toolequip()
- elseif details.name == Tools[2] then
- T.select(i)
- equipLeft = T.equipLeft()
- end
- end
- end
- end
- end
- end
- T.select(1)
- for i = 1, 2 do
- T.back()
- end
- if not(equipLeft) then
- print("X")
- SaveFile("log", "Tool not found: "..Tools[2], true)
- error()
- end
- print("V")
- else
- T.select(10)
- T.equipLeft()
- T.select(11)
- Toolequip()
- T.select(1)
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details then
- if string.find(details.name, Tools[1]) then
- T.select(i)
- Toolequip()
- elseif details.name == Tools[2] then
- T.select(i)
- equipLeft = T.equipLeft()
- end
- end
- end
- T.select(1)
- if not(equipLeft) then
- print("X")
- SaveFile("log", "Tool not found: "..Tools[2], true)
- error()
- end
- print("V")
- end
- SaveFile("log", "Looking for GPS", false)
- Monitor[0].write("Looking for GPS ")
- local X,Y,Z = gps.locate(3)
- T:setX(X)
- T:setY(Y)
- T:setZ(Z)
- if not(T:getX()) and not(T:getY()) and not(T:getZ()) then
- print("X")
- print("What are the cordinates of the turtle?")
- Monitor[0].write("X: ")
- T:setX(tonumber(read()))
- Monitor[0].write("Y: ")
- T:setY(tonumber(read()))
- Monitor[0].write("Z: ")
- T:setZ(tonumber(read()))
- Monitor[0].write("R: ")
- T:setR(tonumber(read()))
- SaveFile("log", "Looking for home cordinates", false)
- Monitor[0].write("Looking for home cordinates ")
- local file = fs.exists("/HomeCor.txt")
- if file then
- print("V")
- file = fs.open("/HomeCor.txt", "r")
- local HomeCor = UnPack(file.readAll())
- file.close()
- T:setHomeX(HomeCor.X)
- T:setHomeY(HomeCor.Y)
- T:setHomeZ(HomeCor.Z)
- T:setHomeR(HomeCor.R)
- SaveFile("log", "Loaded home cordinates", true)
- else
- print("X")
- print("Cor: X: "..X.." Y: "..Y.." Z: "..Z)
- print("Are these the home cordinates? Y/N")
- local Event, p1, p2 = System.pullEvent("key")
- if p1 == keys.y then
- T:setHomeX(T.getX())
- T:setHomeY(T.getY())
- T:setHomeZ(T.getZ())
- T:setHomeR(T.getR())
- local HomeCor = {X = T:getHomeX(), Y = T:getHomeY(), Z = T:getHomeZ(), R = T:getHomeR()}
- local file = fs.open("/HomeCor.txt", "w")
- file.write(Pack(HomeCor))
- file.close()
- else
- print("What are the home cordinates of the turtle?")
- Monitor[0].write("X: ")
- T:HomeX(tonumber(read()))
- Monitor[0].write("Y: ")
- T:HomeY(tonumber(read()))
- Monitor[0].write("Z: ")
- T:HomeZ(tonumber(read()))
- Monitor[0].write("R: ")
- T:HomeR(tonumber(read()))
- local HomeCor = {X = T:getHomeX(), Y = T:getHomeY(), Z = T:getHomeZ(), R = T:getHomeR()}
- local file = fs.open("/HomeCor.txt", "w")
- file.write(Pack(HomeCor))
- file.close()
- end
- SaveFile("log", "Saved home cordinates", true)
- end
- else
- print("V")
- local SX, SY, SZ = T:getX(), T:getY(), T:getZ()
- T.turnLeft()
- T.forward()
- X, Y, Z = gps.locate(3)
- T:setX(X)
- T:setY(Y)
- T:setZ(Z)
- if T:getX() == SX and T:getZ() == SZ then
- print("Cant move or low fuel!")
- error()
- elseif T:getX() < SX then
- T:setR(4)
- elseif T:getX() > SX then
- T:setR(2)
- elseif T:getZ() < SZ then
- T:setR(1)
- elseif T:getZ() > SZ then
- T:setR(3)
- end
- T.back()
- X, Y, Z = gps.locate(3)
- T:setX(X)
- T:setY(Y)
- T:setZ(Z)
- T.turnRight()
- T:setR(T:getR() - 1)
- T:setR((T:getR() + 1) % 4)
- T:setR(T:getR() + 1)
- SaveFile("log", "Looking for home cordinates", false)
- Monitor[0].write("Looking for home cordinates ")
- local file = fs.exists("/HomeCor.txt")
- if file then
- print("V")
- file = fs.open("/HomeCor.txt", "r")
- local HomeCor = UnPack(file.readAll())
- file.close()
- T:setHomeX(HomeCor.X)
- T:setHomeY(HomeCor.Y)
- T:setHomeZ(HomeCor.Z)
- T:setHomeR(HomeCor.R)
- SaveFile("log", "Loaded home cordinates", true)
- else
- print("X")
- print("Cor: X: "..T:getX().." Y: "..T:getY().." Z: "..T:getZ().." R: "..T:getR())
- print("Are these the home cordinates? Y/N")
- local Event, p1, p2 = System.pullEvent("key")
- if p1 == keys.y then
- T:setHomeX(T:getX())
- T:setHomeY(T:getY())
- T:setHomeZ(T:getZ())
- T:setHomeR(T:getR())
- local HomeCor = {X = T:getHomeX(), Y = T:getHomeY(), Z = T:getHomeZ(), R = T:getHomeR()}
- local file = fs.open("/HomeCor.txt", "w")
- file.write(Pack(HomeCor))
- file.close()
- else
- print("What are the home cordinates of the turtle?")
- Monitor[0].write("X: ")
- T:setHomeX(tonumber(read()))
- Monitor[0].write("Y: ")
- T:setHomeY(tonumber(read()))
- Monitor[0].write("Z: ")
- T:setHomeZ(tonumber(read()))
- Monitor[0].write("R: ")
- T:setHomeR(tonumber(read()))
- local HomeCor = {X = T:getHomeX(), Y = T:getHomeY(), Z = T:getHomeZ(), R = T:getHomeR()}
- local file = fs.open("/HomeCor.txt", "w")
- file.write(Pack(HomeCor))
- file.close()
- end
- SaveFile("log", "Saved home cordinates", true)
- end
- end
- function SortStorage(N)
- SaveFile("log", "Sorting storage", true)
- T:GoTo(Chests[1])
- T.select(1)
- local a, b = 0, 0
- for i = 1, 13 do T.suckDown() end
- if Status == 5 or Status == 6 then
- a = 8
- elseif Status > 6 then
- a = 9
- end
- if Status < 6 then
- b = 14
- elseif Status >= 6 then
- b = 13
- end
- for g = 2, a do
- T:GoTo(Chests[g])
- local Data = {{"niks"}, {"log", "planks", "stick", "sign", "ladder", "torch"}, {"stone"}, {"sand", "dirt", "sugar_cane", "glas", "paper"}, {"redstone"}, {"iron_ore", "iron_ingot", "gold_ore", "gold_ingot"}, {"coal"}, {"diamond", "lapis", "emerald"}, {"sapling","bone","seed"}}
- for i = 1, 16 do
- local Deta = T.getItemDetail(i)
- if Deta then
- for j = 1, #Data[g] do
- if g == 3 and not(string.find(Deta.name, "redstone")) and string.find(Deta.name, Data[g][j]) then
- T.select(i)
- T.dropDown()
- elseif g ~= 3 and string.find(Deta.name, Data[g][j]) then
- T.select(i)
- T.dropDown()
- end
- end
- end
- end
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- T.select(1)
- local chest1 = Per.wrap("bottom")
- local chest2 = Per.wrap("top")
- local size1 = chest1.size()
- local size2 = chest2.size()
- for i = 1, size1 do
- chest1.pushItems("top", i, 64)
- end
- for i = 1, size2 do
- local Deta = chest2.getItemDetail(i)
- if Deta then
- for j = 1, #Data[g] do
- if g == 3 and not(string.find(Deta.name, "redstone")) and string.find(Deta.name, Data[g][j]) then
- chest2.pushItems("bottom", i, 64)
- elseif g ~= 3 and string.find(Deta.name, Data[g][j]) then
- chest2.pushItems("bottom", i, 64)
- end
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- T.select(1)
- end
- T:GoTo(Chests[1])
- for i = 1, b do
- T.select(i)
- T.dropDown()
- end
- if N == nil or N == 0 or N == 1 then
- SortStorage(2)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- end
- end
- function checkForOre()
- local Data = "minecraft:coal_ore,minecraft:iron_ore,minecraft:redstone_ore,minecraft:diamond_ore,minecraft:gold_ore,minecraft:emerald_ore,minecraft:lapis_ore"
- for i = 1, 4 do
- local succes2, data2 = T.inspectDown()
- if succes2 then
- if data2.name == "minecraft:lava" and T:getLavafoundLava() == false and Status > 7 then
- T:setLava(true)
- local slot = T.getSelectedSlot()
- T.select(bucketSlot)
- T.placeDown()
- T.select(slot)
- elseif string.find(Data, data2.name) then
- T.digDown()
- T:Down()
- checkForOre()
- T:Up()
- end
- end
- local succes1, data1 = T.inspectUp()
- if succes1 then
- if data1.name == "minecraft:lava" and T:getLavafoundLava() == false and Status > 7 then
- T:setLava(true)
- local slot = T.getSelectedSlot()
- T.select(bucketSlot)
- T.placeUp()
- T.select(slot)
- elseif string.find(Data, data1.name) then
- T.digUp()
- T:Up()
- checkForOre()
- T:Down()
- end
- end
- local succes, data = T.inspect()
- if succes then
- if data.name == "minecraft:lava" and T:getLavafoundLava() == false and Status > 7 then
- T:setLava(true)
- local slot = T.getSelectedSlot()
- T.select(bucketSlot)
- T.place()
- T.select(slot)
- elseif string.find(Data, data.name) then
- T.dig()
- T:Forward()
- checkForOre()
- T:Back()
- end
- end
- T:TurnLeft()
- end
- end
- function checkForLeaves()
- for i = 1, 4 do
- local succes, data = T.inspect()
- if succes then
- if string.find(data.name, "leaves") or string.find(data.name, "oak") then
- T.dig()
- T:Forward()
- checkForLeaves()
- T:Back()
- end
- end
- T:TurnLeft()
- end
- end
- function HarvestTrees(N)
- local succes, details = T.inspect()
- while not(succes) do
- Monitor[0].write("Plant Sapling!!!")
- sleep(25)
- Monitor[0].clearLine()
- sleep(5)
- succes, details = T.inspect()
- end
- while succes and not(string.find(details.name, "log")) do
- sleep(30)
- succes, details = T.inspect()
- end
- T.select(1)
- T.dig()
- T:Forward()
- local a = 0
- while T.detectUp() do
- T.digUp()
- T:Up()
- a = T:Add(a, 1)
- checkForLeaves()
- end
- if N == 1 then
- T.refuel(2)
- end
- for i = 1, a do
- T:Down()
- end
- T:Back()
- end
- function FirstTree()
- T.select(1)
- if T.getFuelLevel() <= 50 then
- if not(T.refuel()) then
- T.dig()
- T.refuel()
- end
- end
- T.select(1)
- SaveFile("log", "First tree", false)
- Monitor[0].write("First tree ")
- for i = 1, 10 do
- HarvestTrees(1)
- local number, Slots = T:LookInvItems("sapling", true)
- if number > 0 then
- T.select(Slots[1])
- T.place()
- T.select(1)
- local succes, details = T.inspect()
- while not(string.find(details.name, "log")) do
- sleep(30)
- succes, details = T.inspect()
- end
- end
- end
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if not(string.find(details.name, "log")) then
- T.select(i)
- T.refuel()
- end
- end
- T.select(1)
- print("V")
- Status = 2
- SaveFile("status")
- end
- function ChopTree()
- SaveFile("log", "Chop tree", true)
- T.select(1)
- T.dig()
- T:Forward()
- local a = 0
- while T.detectUp() do
- T.digUp()
- T:Up()
- a = T:Add(a, 1)
- checkForLeaves()
- end
- for i = 1, a do
- T:Down()
- end
- T:Back()
- end
- function MakeChest()
- T.select(16)
- Toolequip()
- local CT = false
- SaveFile("log", "Looking for crafting table", true)
- local i = 1
- while not(CT) do
- local count, slot = T:LookInvItems(Tools[4], false)
- if count > 0 then
- SaveFile("log", "Found crafting table", true)
- CT = true
- T.select(slot[1])
- Toolequip()
- end
- if not(CT)then
- if i == 1 then
- SaveFile("log", "Waiting for crafting table", true)
- i = 2
- end
- sleep(1,5)
- end
- end
- GetModem()
- SaveFile("log", "Crafting Chest", true)
- local count, slots = T:LookInvItems("log", true)
- if count >= 6 then
- for i = 1, 16 do
- for j = 1, #slots do
- if i ~= slots[j] then
- T.select(i)
- T.drop()
- end
- end
- end
- for i = 2, #slots do
- T.select(i)
- T.drop()
- end
- T.select(slots[1])
- T.transferTo(4, 64)
- T.select(4)
- T.transferTo(1, 6)
- T.drop()
- T.craft(4)
- T.transferTo(1, 3)
- T.transferTo(2, 3)
- T.transferTo(3, 3)
- T.transferTo(5, 3)
- T.transferTo(7, 3)
- T.transferTo(9, 3)
- T.transferTo(10, 3)
- T.transferTo(11, 3)
- T.select(4)
- T.drop()
- T.select(8)
- T.drop()
- T.select(12)
- T.drop()
- T.select(13)
- T.drop()
- T.select(14)
- T.drop()
- T.select(15)
- T.drop()
- T.select(16)
- T.drop()
- T.select(8)
- T.craft(2)
- T.transferTo(chestSlot, 1)
- SaveFile("log", "Making little storage", true)
- for i = 1, 2 do
- local Succec = T.suck()
- while Succec do
- Succec = T.suck()
- end
- T.dig()
- T:Forward()
- end
- T.dig()
- local Succec = T.suck()
- while Succec do
- Succec = T.suck()
- end
- GetModem()
- T.select(8)
- T.digDown()
- T.placeDown()
- Chests[1].X, Chests[1].Y, Chests[1].Z = T:getX(), T:getY(), T:getZ()
- SaveFile("chests")
- T:TurnRight()
- T:Forward()
- T:TurnLeft()
- T.placeDown()
- T:TurnRight()
- T:Back()
- T:TurnLeft()
- T:Back()
- T:Back()
- else
- SaveFile("log", "No Logs Found", true)
- error()
- end
- T:emptyInv()
- Status = 3
- SaveFile("status")
- end
- function HarvestAllTrees()
- if T.getFuelLevel() < 500 and Status > 5 then
- T:Refuel()
- elseif T.getFuelLevel() < 500 and Status <= 5 then
- local succes, Succes = {}, false
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, T.refuel())
- end
- T.select(1)
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- while not(Succes) do
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- end
- end
- GetModem()
- SaveFile("log", "Looking for all trees in 32X32 erea", true)
- local a = 1
- while a < 33 do
- if T.getFuelLevel() < 500 then
- T:Refuel()
- end
- for i = 1, 2 do
- for I = 1, a do
- local succes, tabel = T.inspect()
- local succes1, tabel1 = T.inspectDown()
- if not(succes1) then
- T:Down()
- elseif succes1 then
- if string.find(tabel1.name, "log") then
- T.digDown()
- T:Down()
- elseif string.find(tabel1.name, "water") then
- if not(Water.found) then
- Water.found = true
- Water.x, Water.y, Water.z = T:getX(), T:getY(), T:getZ()
- SaveFile("log", "Water found: "..tostring(Water.found).." at: "..Water.x.." "..Water.y.." "..Water.z, true)
- SaveFile("locations")
- end
- elseif tabel1.name == "minecraft:sand" or tabel1.name == "minecraft:red_sand" then
- if not(Sand.found) then
- Sand.found = true
- Sand.x, Sand.y, Sand.z = T:getX(), T:getY(), T:getZ()
- SaveFile("log", "Sand found: "..tostring(Sand.found).." at: "..Sand.x.." "..Sand.y.." "..Sand.z, true)
- SaveFile("locations")
- end
- end
- end
- if succes then
- if string.find(tabel.name, "log") then
- ChopTree()
- elseif string.find(tabel.name, "sugar_cane") then
- while T.detect() do
- T:Up()
- end
- T:Forward()
- local succes1, tabel1 = T.inspectDown()
- while string.find(tabel1.name, "sugar_cane") do
- T.digDown()
- T:Down()
- succes1, tabel1 = T.inspectDown()
- end
- T:Back()
- end
- while T.detect() do
- T.digUp()
- T:Up()
- succes, tabel = T.inspect()
- if succes then
- if string.find(tabel.name, "log") then
- ChopTree()
- end
- end
- end
- end
- T:Forward()
- end
- T:TurnRight()
- end
- a = T:Add(a, 1)
- end
- T:GoHome()
- T:emptyInv()
- Status = 4
- SaveFile("status")
- end
- function GetCobbleStone()
- if not(Water.found) and not(Sand.found) then
- SaveFile("log", "Sand found: "..tostring(Sand.found).." Water found: "..tostring(Water.found), true)
- error()
- elseif not(Water.found) then
- SaveFile("log", "Water found: "..tostring(Water.found), true)
- error()
- elseif not(Sand.found) then
- SaveFile("log", "Sand found: "..tostring(Sand.found), true)
- error()
- end
- if T.getFuelLevel() < 500 and Status > 5 then
- T:Refuel()
- elseif T.getFuelLevel() < 500 and Status <= 5 then
- local succes, Succes = {}, false
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, T.refuel())
- end
- T.select(1)
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- while not(Succes) do
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- end
- end
- GetModem()
- SaveFile("log", "Looking for cobblestone", true)
- T.select(1)
- while T:getY() > 7 do
- T.digDown()
- T:Down()
- checkForOre()
- for i = 1,4 do
- T.dig()
- T:TurnLeft()
- end
- end
- for i = 1, 64 do
- checkForOre()
- T.dig()
- T.digUp()
- T.digDown()
- T:Forward()
- T:SortInvItems(1)
- end
- for i = 1, 64 do T:Back() end
- while T:getY() < (T:getHomeY() - 2) do
- T:Up()
- end
- local count, slots = T:LookInvItems("cobblestone", true)
- T.select(slots[1])
- for i = 1, 2 do
- for I = 1, 4 do
- T.place()
- T:TurnLeft()
- end
- T:Up()
- T.placeDown()
- end
- if T:getX() ~= T:getHomeX() or T:getY() ~= T:getHomeY() or T:getZ() ~= T:getHomeZ() or T:getR() ~= T:getHomeR() then
- -- gohome
- if T.getFuelLevel() <= 500 then
- T:Refuel()
- end
- T:GoHome()
- end
- T:emptyInv()
- Status = 5
- SaveFile("status")
- end
- function MakeStorage()
- if T.getFuelLevel() < 500 and Status > 5 then
- T:Refuel()
- elseif T.getFuelLevel() < 500 and Status <= 5 then
- local succes, Succes = {}, false
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, T.refuel())
- end
- T.select(1)
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- while not(Succes) do
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- end
- end
- SaveFile("log", "Making chests", true)
- for i = 1, 2 do
- T:Forward()
- end
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "log") or string.find(Details.name, "planks") then
- chest1.pushItems("top", i, 64)
- end
- end
- end
- while T.suckUp() do end
- local count, slots = T:LookInvItems("planks", true)
- local Details = T.getItemDetail(slots[1])
- if Details.count >= 56 then
- SaveFile("log", "Crafting chest", true)
- T:Craft("chest", 7, "planks")
- T.transferTo(chestSlot)
- else
- count, slots = T:LookInvItems("log", true)
- local Details = T.getItemDetail(slots[1])
- if Details.count >= 14 then
- SaveFile("log", "Crafting planks", true)
- T:Craft("planks", 56, "log")
- count, slots = T:LookInvItems("planks", true)
- if count >= 56 then
- SaveFile("log", "Crafting chest", true)
- T:Craft("chest", 7, "planks")
- T.transferTo(chestSlot)
- else
- T.select(chestSlot)
- T.digUp()
- for i = 1, 2 do
- T:Back()
- end
- SaveFile("log", "Not enuf planks", true)
- error()
- end
- else
- T.select(chestSlot)
- T.digUp()
- for i = 1, 2 do
- T:Back()
- end
- SaveFile("log", "Not enuf logs", true)
- error()
- end
- end
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "cobblestone") then
- chest1.pushItems("top", i, 64)
- end
- end
- end
- T.select(1)
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- for i = 1, 2 do
- T:Back()
- end
- SaveFile("log", "Making storage", true)
- local count, slots = T:LookInvItems("cobblestone", true)
- T.select(slots[1])
- T:TurnLeft()
- T:TurnLeft()
- T.checkUp()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T:TurnLeft()
- T:Forward()
- T.checkUp()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:Back()
- T.checkUp()
- T:TurnRight()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T:TurnLeft()
- T:Forward()
- T.checkUp()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:Back()
- T.checkUp()
- T:TurnLeft()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- T:TurnLeft()
- T:Forward()
- T.checkUp()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:Back()
- T.checkUp()
- T:TurnLeft()
- T:Forward()
- T.checkUp()
- local a = 2
- for i = 1, 15 do
- if (i%2) == 1 and i < 16 then
- T.select(1)
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- else
- T.select(1)
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- GetChest()
- T.select(chestSlot)
- T.placeDown()
- Chests[a].X, Chests[a].Y, Chests[a].Z = T:getX(), T:getY(), T:getZ()
- a = T:Add(a, 1)
- T.select(1)
- end
- end
- SaveFile("chests")
- for i = 1, 2 do
- T.dig()
- T:Forward()
- end
- Mine.x, Mine.y, Mine.z = T:getX(), T:getY(), T:getZ()
- Mine.found = true
- SaveFile("locations")
- for i = 1, 2 do
- T:Back()
- end
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- for i = 1, 16 do
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- end
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.dig()
- T:Forward()
- T.checkUp()
- T:TurnLeft()
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- T.dig()
- T:Forward()
- T.checkUp()
- for i = 1, 14 do
- T.dig()
- T:Forward()
- T.checkUp()
- T.digDown()
- T.placeDown()
- end
- T:GoHome()
- T:emptyInv()
- for i = 1, 2 do SortStorage() end
- Status = 6
- SaveFile("status")
- end
- function Makefurnace()
- SaveFile("log", "Crafting furnace", true)
- local number = T:findChest("stone")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "cobblestone") then
- chest1.pushItems("top", i, 8)
- break
- end
- end
- end
- while T.suckUp() do end
- local count, slots = T:LookInvItems("cobblestone", true)
- if count >= 8 then
- T:Craft("furnace", 1, "cobblestone")
- else
- SaveFile("log", "Not enuf cobblestone for furnace", true)
- error()
- end
- T.select(modemSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems("top", i, 1)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- count, slots = T:LookInvItems("furnace", true)
- T.select(slots[1])
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SaveFile("log", "Placeing furnace", true)
- T:GoTo(Chests[1])
- T.placeUp()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- else
- SaveFile("log", "Cant find stone chest", true)
- error()
- end
- end
- function MakeBucket()
- SaveFile("log", "Crafting Bucket", true)
- local number = T:findChest("iron")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "iron") then
- chest1.pushItems("top", i, 3)
- end
- end
- end
- while T.suckUp() do end
- local count, slots = T:LookInvItems("ingot", true)
- if count >= 3 then
- T:Craft("bucket", 1, "ingot")
- T.select(modemSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems("top", i, 1)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- else
- local count, slots = T:LookInvItems("ore", true)
- if count >= 3 then
- for i = 1, 16 do
- local found = false
- for j = 1, #slots do
- if i == slots[j] then
- found = true
- end
- end
- if not(found) then
- clsTurtle.select(i)
- clsTurtle.dropDown()
- end
- end
- if #slots >= 2 then
- for i = 2, #slots do
- clsTurtle.select(slots[i])
- clsTurtle.dropDown()
- end
- end
- T.select(modemSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems("top", i, 1)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- local number = T:findChest("wood")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "log") then
- chest1.pushItems("top", i, 4)
- break
- end
- end
- end
- while T.suckUp() do end
- for i = 1, 16 do
- local Details = T.getItemDetail(i)
- if Details then
- if not(string.find(Details.name, "log")) and not(string.find(Details.name, "iron")) then
- T.select(i)
- T.dropDown()
- end
- end
- end
- T.select(chestSlot)
- T.digUp()
- T:GoTo(Chests[1])
- T:TurnDirection(T.HomeR)
- local count1, slots1 = T:LookInvItems("ore", true)
- local count2, slots2 = T:LookInvItems("log", true)
- T.select(slots1[1])
- T:Back()
- for i = 1, 2 do
- T:Up()
- end
- T:Forward()
- T.dropDown(3)
- T.select(slots2[1])
- T:Back()
- T:Down()
- T.suck()
- T.drop(4)
- T:Down()
- T:GoTo(Chests[1])
- sleep(1)
- for i = 1, 16 do
- T.select(i)
- T.dropDown()
- end
- sleep(29)
- T.select(4)
- T.suckUp()
- T:Craft("bucket", 1, "ingot")
- else
- SaveFile("log", "Cant find wood chest", true)
- error()
- end
- else
- T.select(chestSlot)
- T.digUp()
- SaveFile("log", "Not enuf iron for bucket", true)
- error()
- end
- end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SortStorage()
- T:GoTo(Chests[1])
- T.select(1)
- while T.suckDown() do end
- local Details = T.getItemDetail(bucketSlot)
- if Details and not(string.find(Details.name, "bucket")) then
- T.select(bucketSlot)
- T.dropDown()
- end
- Details = T.getItemDetail(chestSlot)
- if Details and not(string.find(Details.name, "chest")) then
- T.select(chestSlot)
- T.dropDown()
- end
- for i = 1, 13 do
- Details = T.getItemDetail(i)
- T.select(i)
- if Details and string.find(Details.name, "chest") then
- T.transferTo(chestSlot, 1)
- T.dropDown()
- elseif Details and string.find(Details.name, "bucket") then
- T.transferTo(bucketSlot, 1)
- T.dropDown()
- else
- T.dropDown()
- end
- end
- Details = T.getItemDetail(bucketSlot)
- if Details and not(string.find(Details.name, "bucket")) then
- GetChest()
- T.select(chestSlot)
- T.place()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(bucketSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details and string.find(Details.name, "bucket") then
- chest1.pushItems("front", i, 1)
- break
- end
- end
- T.suck()
- T.select(chestSlot)
- T.dig()
- end
- T.select(1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- else
- SaveFile("log", "Cant find iron chest", true)
- error()
- end
- end
- function MakeSaplingChest()
- SaveFile("log", "Crafting Chest", true)
- local number = T:findChest("wood")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "log") then
- chest1.pushItems("top", i, 2)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(bucketSlot)
- T.dropUp()
- T.select(modemSlot)
- T.dropUp()
- T:Craft("planks", 8, "log")
- T:Craft("chest", 1, "planks")
- local S = T.getSelectedSlot()
- T.select(bucketSlot)
- T.suckUp()
- T.select(modemSlot)
- T.suckUp()
- T.select(S)
- T.digUp()
- T.transferTo(chestSlot, 1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SaveFile("log", "Placeing Chest", true)
- T:TurnLeft()
- T:Forward()
- T.select(1)
- for i = 1, 2 do
- T.digDown()
- T:Down()
- end
- T.placeDown()
- T:Up()
- local count, slots = T:LookInvItems("chest", true)
- T.select(slots[1])
- T.placeDown()
- Chests[9].X, Chests[9].Y, Chests[9].Z = T:getX(), T:getY(), T:getZ()
- SaveFile("chests")
- T:Up()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- T.select(1)
- T:emptyInv()
- Status = 7
- SaveFile("status")
- else
- SaveFile("log", "Cant find wood chest", true)
- error()
- end
- end
- function MakeHopper()
- SaveFile("log", "Crafting Chest", true)
- local number = T:findChest("wood")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "log") then
- chest1.pushItems("top", i, 2)
- break
- end
- end
- end
- while T.suckUp() do end
- T:Craft("planks", 8, "log")
- T:Craft("chest", 1, "planks")
- T.select(2)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "log") then
- chest1.pushItems("top", i, 4)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(modemSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems("top", i, 1)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(4)
- T.digUp()
- T.transferTo(chestSlot, 1)
- T.select(1)
- SaveFile("log", "Crafting Hopper", true)
- local number = T:findChest("iron")
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "ore") then
- chest1.pushItems("top", i, 5)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(modemSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems("top", i, 1)
- break
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- T:GoTo(Chests[1])
- T:TurnDirection(T:getHomeR())
- T:Back()
- for i = 1, 2 do
- T:Up()
- end
- T:Forward()
- local count, slots = T:LookInvItems("ore", true)
- T.select(slots[1])
- T.dropDown()
- T:Back()
- T:Down()
- local count, slots = T:LookInvItems("log", true)
- T.select(slots[1])
- T.suck()
- T.drop(4)
- T:Down()
- T:Forward()
- T.dropDown()
- GetChest()
- T.select(chestSlot)
- T.place()
- T.select(modemSlot)
- T.drop()
- sleep(60)
- T.select(8)
- T.suckUp()
- T.transferTo(1, 1)
- T.transferTo(3, 1)
- T.transferTo(5, 1)
- T.transferTo(7, 1)
- T.transferTo(10, 1)
- local count, slots = T:LookInvItems("chest", true)
- T.select(slots[1])
- T.transferTo(6, 1)
- T.craft()
- T.select(modemSlot)
- T.suck()
- T.select(chestSlot)
- T.dig()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SaveFile("log", "Placeing Hopper", true)
- T.select(slots[1])
- T:TurnLeft()
- for i = 1, 3 do
- T:Forward()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- for i = 1, 2 do
- T.digDown()
- T:Down()
- T.dig()
- end
- T.place()
- T:GoHome()
- else
- SaveFile("log", "Cant find iron chest", true)
- error()
- end
- else
- SaveFile("log", "Cant find wood chest", true)
- error()
- end
- end
- function MakeTorches()
- SaveFile("log", "Crafting torches", true)
- local number = T:findChest("wood")
- local sticks, planks, logs = false, false, false
- if number then
- T:GoTo(Chests[number])
- GetChest()
- T.select(chestSlot)
- T.placeUp()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(4)
- if not(sticks) then
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if Details.count >= 1 and string.find(Details.name, "stick") and not(sticks) then
- chest1.pushItems("top", i, 1)
- sticks = true
- end
- end
- end
- end
- if not(sticks) and not(planks) then
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if Details.count >= 2 and string.find(Details.name, "planks") and not(sticks) and not(planks) then
- chest1.pushItems("top", i, 2)
- planks = true
- end
- end
- end
- end
- if (sticks or planks) and not(logs) then
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if Details.count >= 2 and string.find(Details.name, "log") and (sticks or planks) and not(logs) then
- chest1.pushItems("top", i, 2)
- logs = true
- break
- end
- end
- end
- end
- if not(sticks) and not(planks) and not(logs) then
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if Details.count >= 3 and string.find(Details.name, "log") and not(sticks) and not(planks) and not(logs) then
- chest1.pushItems("top", i, 3)
- logs = true
- break
- end
- end
- end
- end
- while T.suckUp() do end
- T.select(chestSlot)
- T.digUp()
- local number, logsslots = T:LookInvItems("log", true)
- local Countt = T.getItemCount(4)
- if not(logs) then
- if Status >= 16 then
- HarvestTreeFarm()
- local stone, mess = T:GetItemFromChest("wood", "log", 3, 4)
- else
- SaveFile("log", "Not enuf logs", true)
- error()
- end
- end
- T:GoTo(Chests[1])
- T:TurnDirection(T.HomeR)
- T:Back()
- for i = 1, 2 do
- T:Up()
- end
- T:Forward()
- T.select(logsslots[1])
- T.dropDown(1)
- T:Back()
- T:Down()
- T.suck()
- T.drop(1)
- T:Down()
- T:Forward()
- GetChest()
- T.select(chestSlot)
- T.place()
- T.select(modemSlot)
- T.dropDown()
- T.select(bucketSlot)
- T.dropDown()
- if not(planks) and not(sticks) and logs then
- local number, stickslots = T:LookInvItems("log", true)
- for i = 1, 15 do
- if i ~= stickslot[1] then
- T.select(i)
- T.dropDown()
- end
- end
- T.select(logsslots[1])
- T.transferTo(1,1)
- T.dropDown()
- T.craft()
- planks = true
- end
- local number, planksslots = T:LookInvItems("planks", true)
- if not(sticks) and planks then
- local number, stickslots = T:LookInvItems("planks", true)
- for i = 1, 15 do
- if i ~= stickslot[1] then
- T.select(i)
- T.dropDown()
- end
- end
- T.select(planksslots[1])
- T.transferTo(1,1)
- T.transferTo(5,1)
- T.dropDown()
- T.craft()
- sticks = true
- end
- local number, stickslots = T:LookInvItems("stick", true)
- for i = 1, 15 do
- if i ~= stickslots[1] then
- T.select(i)
- T.dropDown()
- end
- end
- sleep(10)
- T.select(8)
- T.suckUp()
- if sticks then
- T.transferTo(1,1)
- T.dropDown()
- local number, sticksslots = T:LookInvItems("stick", true)
- if sticksslots[1] ~= 4 then
- T.select(sticksslots[1])
- T.transferTo(4,1)
- T.dropDown()
- end
- T.select(4)
- T.transferTo(5,1)
- T.craft()
- else
- T.dropDown()
- end
- T.select(chestSlot)
- T.dig()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- else
- SaveFile("log", "Cant find wood chest", true)
- error()
- end
- end
- function MakeTreeFarm()
- GetModem()
- SaveFile("log", "Makeing Tree Farm", true)
- local torches = T:GetItemFromChest("wood", "torch", 4, 4)
- while not(torches) do
- MakeTorches()
- SortStorage()
- GetModem()
- GetBucket()
- torches = T:GetItemFromChest("wood", "torch", 4, 4)
- end
- local stone = T:GetItemFromChest("stone", "cobblestone", 64, 3)
- local dirt = T:GetItemFromChest("sand", "dirt", 4, 2)
- local sapling = T:GetItemFromChest("sapling", "sapling", 64, 1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if not(stone) then
- SaveFile("log", "Cant find stone", true)
- error()
- end
- if not(dirt) then
- SaveFile("log", "Cant find dirt", true)
- error()
- end
- if not(sapling) then
- SaveFile("log", "Cant find saplings", true)
- error()
- end
- SaveFile("log", "Found:", true)
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- SaveFile("log", "Torchs: "..Torchnumber, true)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- SaveFile("log", "Cobblestone: "..Stonenumber, true)
- local Dirtnumber, Dirtslots = T:LookInvItems("dirt", true)
- SaveFile("log", "Dirt: "..Dirtnumber, true)
- local Saplingnumber, Saplingslots = T:LookInvItems("sapling", true)
- SaveFile("log", "Sapling: "..Saplingnumber, true)
- T:Forward()
- T:TurnLeft()
- T.select(Stoneslots[1])
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 2 do
- T:TurnRight()
- end
- T.place()
- for I = 1, 2 do
- T:TurnLeft()
- end
- for i = 1, 10 do
- T.digDown()
- T.placeDown()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.placeUp()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 2 do
- T:TurnRight()
- end
- T.place()
- for I = 1, 2 do
- T:TurnLeft()
- end
- end
- T:SortInvItems(2)
- local Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- T:TurnLeft()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T:TurnLeft()
- local SSx, SSy, SSz = 0, 0, 0
- for i = 1, 9 do
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T.placeDown()
- if i == 2 then
- SSx, SSy, SSz = T:getX(), (T:getY()+1), T:getZ()
- end
- end
- T:SortInvItems(2)
- local SX, SY, SZ, SR = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoHome()
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stone = T:GetItemFromChest("stone", "cobblestone", 64, 3)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if not(stone) then
- SaveFile("log", "Cant find stone", true)
- error()
- end
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- T:GoTo(SX, SY, SZ)
- T:TurnDirection(SR)
- for i = 1, 2 do
- T:Forward()
- end
- T:TurnRight()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T:TurnRight()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.placeUp()
- T.digDown()
- T.placeDown()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for i = 1, 2 do
- T:TurnRight()
- end
- T.place()
- for i = 1, 2 do
- T:TurnLeft()
- end
- T.digDown()
- T.placeDown()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T:Up()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.placeDown()
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- for i = 1, 9 do
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T.placeDown()
- end
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- for i = 1, 2 do
- T:TurnRight()
- end
- T.place()
- T:TurnLeft()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T:TurnRight()
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T.placeDown()
- T:Up()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.placeDown()
- T:SortInvItems(2)
- SX, SY, SZ, SR = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoHome()
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stone = T:GetItemFromChest("stone", "cobblestone", 64, 3)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if not(stone) then
- SaveFile("log", "Cant find stone", true)
- error()
- end
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- T:GoTo(SX, SY, SZ)
- T:TurnDirection(SR)
- T:TurnRight()
- for i = 1, 9 do
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- end
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- T:TurnLeft()
- for i = 1, 10 do
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- end
- T:TurnLeft()
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- for i = 1, 8 do
- for I = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- for I = 1, 3 do
- T.digUp()
- sleep(0.5)
- end
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- end
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- SX, SY, SZ, SR = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoHome()
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stone = T:GetItemFromChest("stone", "cobblestone", 64, 3)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if not(stone) then
- SaveFile("log", "Cant find stone", true)
- error()
- end
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T.select(Stoneslots[1])
- T:GoTo(SX, SY, SZ)
- T:TurnDirection(SR)
- T:Back()
- T:TurnLeft()
- T:Forward()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- for I = 1, 7 do
- for i = 1, 8 do
- for l = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T.digUp()
- T.digDown()
- T.placeDown()
- end
- if (I%2) == 1 and I < 7 then
- T:TurnLeft()
- for l = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T.digUp()
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- elseif I < 7 then
- T:TurnRight()
- for l = 1, 3 do
- T.dig()
- sleep(0.5)
- end
- T:Forward()
- T.digUp()
- T.digDown()
- T.placeDown()
- T:TurnRight()
- end
- end
- T:SortInvItems(2)
- T:Up()
- T.select(bucketSlot)
- if not(Water.found) then
- SaveFile("log", "No water found", true)
- error()
- end
- for i = 1, 9 do
- SX, SY, SZ, SR = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(Water.x, SY, Water.z)
- T:GoTo(Water.x, Water.y, Water.z)
- while not(T.inspectDown()) do
- T:Down()
- end
- local succes, data = T.inspectDown()
- if succes then
- local a = 2
- if not(string.find(data.name, "water")) then
- T:Forward()
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- T:Forward()
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- a = a + 1
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- a = a + 1
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- a = a + 1
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- a = a + 1
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if not(string.find(data.name, "water")) then
- T:TurnRight()
- for i = 1, a do
- T:Forward()
- end
- end
- if string.find(data.name, "water") then
- Water.x, Water.y, Water.z = T:getX(), T:getY(), T:getZ()
- SaveFile("locations")
- T.placeDown()
- end
- end
- T:GoTo(SX, SY, SZ)
- T:TurnDirection(SR)
- T.placeDown()
- T:Back()
- end
- T.select(Dirtslots[1])
- for i = 1, 3 do
- T.dig()
- T:Forward()
- T.dig()
- end
- T:TurnRight()
- T.dig()
- T:Forward()
- T.dig()
- T.place()
- T.select(Saplingslots[1])
- T.digUp()
- T:Up()
- T.dig()
- T.place()
- T:Down()
- T:Back()
- T.select(Torchslots[1])
- T.place()
- for I = 1, 3 do
- T.select(Dirtslots[1])
- T:TurnLeft()
- for i = 1, 4 do
- T.dig()
- T:Forward()
- T.dig()
- end
- T:TurnRight()
- for i = 1, 2 do
- T.dig()
- T:Forward()
- T.dig()
- end
- T:TurnRight()
- T.dig()
- T.place()
- T.select(Saplingslots[1])
- T.digUp()
- T:Up()
- T.dig()
- T.place()
- T:Down()
- T:Back()
- T.select(Torchslots[1])
- T.place()
- end
- T.select(bucketSlot)
- T:GoTo(Water.x, (T:getY()+1), Water.z)
- T:GoTo(Water.x, Water.y, Water.z)
- T.placeDown()
- T:GoTo(SSx, (SSy+1), SSz)
- T:GoTo(SSx, SSy, SSz)
- T.placeDown()
- T.select(1)
- T:GoHome()
- T:emptyInv()
- Status = 8
- SaveFile("status")
- end
- function HarvestTreeFarm()
- local sapling, mess = T:GetItemFromChest("sapling", "sapling", 4, 1)
- if not(sapling) then
- SaveFile("log", mess, true)
- error()
- end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- for i = 1, 3 do
- T:Back()
- end
- for i = 1, 2 do
- T:Up()
- end
- T:TurnLeft()
- for i = 1, 3 do
- T:Forward()
- end
- T.select(1)
- HarvestTrees(2)
- for i = 1, 2 do
- T:Forward()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- local saplingnumber, saplingslots = T:LookInvItems("sapling", true)
- T.select(saplingslots[1])
- T.place()
- T.select(1)
- for i = 1, 2 do
- T:TurnRight()
- end
- T:Forward()
- for i = 1, 2 do
- HarvestTrees(2)
- T:Forward()
- T:TurnLeft()
- T:Forward()
- for i = 1, 2 do
- T:TurnLeft()
- end
- saplingnumber, saplingslots = T:LookInvItems("sapling", true)
- T.select(saplingslots[1])
- T.place()
- T.select(1)
- for i = 1, 2 do
- T:TurnRight()
- end
- T:Forward()
- end
- HarvestTrees(2)
- for i = 1, 2 do
- T:Forward()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- T.place()
- for i = 1, 2 do
- T:TurnRight()
- end
- for i = 1, 2 do
- T:Forward()
- end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SortStorage()
- end
- function MineNow()
- SaveFile("log", "Mine Front", true)
- local Ro = T:getR()
- for i = 1, 36 do
- checkForOre()
- while T.dig() do end
- while T.digUp() do end
- T.digDown()
- T:Forward()
- end
- T:SortInvItems(1)
- checkForOre()
- T:SortInvItems(1)
- for I = 1, 18 do
- T:TurnLeft()
- SaveFile("log", "Mine Left", true)
- for i = 1, 18 do
- checkForOre()
- while T.dig() do end
- while T.digUp()do end
- T.digDown()
- T:Forward()
- end
- checkForOre()
- while T.digUp() do end
- T.digDown()
- SaveFile("log", "Back up", true)
- for i = 1, 18 do
- T:Back()
- end
- for i = 1,2 do
- T:TurnRight()
- end
- SaveFile("log", "Mine Right", true)
- for i = 1, 18 do
- checkForOre()
- while T.dig() do end
- while T.digUp()do end
- T.digDown()
- T:Forward()
- end
- checkForOre()
- while T.digUp() do end
- T.digDown()
- SaveFile("log", "Back up", true)
- for i = 1, 18 do
- T:Back()
- end
- T:TurnLeft()
- SaveFile("log", "Back up", true)
- for i = 1, 2 do
- checkForOre()
- T:Back()
- end
- T:SortInvItems(1)
- end
- T:GoTo(Mine.x, T:getY(), Mine.z)
- T:TurnDirection(Ro)
- end
- function GoMine(N)
- GetBucket()
- GetModem()
- if not(Mine.found) then
- local number = T:findChest("diamond")
- if number then
- T:GoTo(Chests[number])
- for i = 1, 2 do
- T.dig()
- T:Forward()
- end
- Mine.x, Mine.y, Mine.z = T:getX(), T:getY(), T:getZ()
- Mine.found = true
- SaveFile("locations")
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- else
- SaveFile("log", "Cant find diamond chest", true)
- error()
- end
- end
- local A = 20
- if N == 2 then
- A = T:Add(A,1)
- elseif N == 3 then
- A = T:Sub(A,1)
- end
- SaveFile("log", "Makeing Mine Shaft", true)
- T:Refuel()
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T.select(1)
- if A == 20 then
- while T.digUp() do end
- T:Up()
- while T.detectUp() do
- while T.digUp() do end
- T:Up()
- end
- while T.digUp() do end
- end
- while T:getY() > A do
- checkForOre()
- T.digDown()
- T:Down()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- local RS = T:getR()
- T:SortInvItems(1)
- SaveFile("log", "Mine Layer "..A, true)
- MineNow()
- T:SortInvItems(1)
- T:GoHome()
- SortStorage()
- T:Refuel()
- GetBucket()
- GetModem()
- T:GoTo(Mine.x, Mine.y, Mine.z)
- A = T:Sub(A,3)
- for o = 1, 3 do
- while T:getY() > A do
- checkForOre()
- T.digDown()
- T:Down()
- end
- T:TurnDirection(RS)
- T:SortInvItems(1)
- SaveFile("log", "Mine Layer "..A, true)
- MineNow()
- T:SortInvItems(1)
- T:GoHome()
- SortStorage()
- T:Refuel()
- GetBucket()
- GetModem()
- T:GoTo(Mine.x, Mine.y, Mine.z)
- A = T:Sub(A,3)
- end
- while T:getY() > A do
- checkForOre()
- T.digDown()
- T:Down()
- end
- T:TurnDirection(RS)
- T:SortInvItems(1)
- SaveFile("log", "Mine Layer "..A, true)
- MineNow()
- T:SortInvItems(1)
- T:GoHome()
- SortStorage()
- GetBucket()
- GetModem()
- if A == 8 then
- local stone = T:GetItemFromChest("stone", "cobblestone", 64, 1)
- if stone then
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T.select(1)
- while T.digUp() do end
- while T.dig() do end
- T:Forward()
- while T.digUp() do end
- T.digDown()
- T.placeDown()
- T:TurnLeft()
- while T.dig() do end
- T:Forward()
- while T.digUp() do end
- T.digDown()
- T.placeDown()
- T:Back()
- for i = 1, 2 do
- T:TurnRight()
- end
- while T.dig() do end
- T:Forward()
- while T.digUp() do end
- T.digDown()
- T.placeDown()
- T:Back()
- T:TurnLeft()
- T:Back()
- T:TurnLeft()
- while T.dig() do end
- T:Forward()
- while T.digUp() do end
- T.digDown()
- T.placeDown()
- T:Back()
- for i = 1, 2 do
- T:TurnRight()
- end
- while T.dig() do end
- T:Forward()
- while T.digUp() do end
- T.digDown()
- T.placeDown()
- T:Back()
- T:TurnLeft()
- else
- SaveFile("log", "Cant find stone", true)
- error()
- end
- end
- T:GoHome()
- SortStorage()
- T:Refuel()
- GetBucket()
- GetModem()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if A == 8 then
- Status = 9
- elseif A == 9 then
- Status = 10
- end
- SaveFile("status")
- end
- function MakeGenerate()
- SaveFile("log", "Makeing cobblestone generator", true)
- GetBucket()
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 57, 1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- for i = 1, 3 do T:Forward() end
- T:TurnLeft()
- for i = 1, 2 do T:Forward() end
- local stonecount, stoneslots = T:LookInvItems("cobblestone", true)
- local bucketcount, bucketslots = T:LookInvItems("bucket", true)
- if bucketcount == 0 then
- SaveFile("log", "Cant find lava_bucket", true)
- error()
- end
- T.select(stoneslots[1])
- T:TurnLeft()
- T:Forward()
- T:Up()
- T.place()
- T:TurnRight()
- for i = 1, 2 do
- T:Forward()
- T:TurnLeft()
- T.place()
- T:TurnRight()
- end
- T:Up()
- T:TurnRight()
- for i = 1, 5 do
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T.placeDown()
- if i < 5 then
- T:Forward()
- end
- end
- T:TurnRight()
- for i = 1, 2 do T:Forward() end
- T:TurnRight()
- for i = 1, 5 do
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- if i ~= 4 then
- T.placeDown()
- end
- T:Up()
- T.placeDown()
- if i < 5 then
- T:Forward()
- end
- end
- for i = 1, 4 do T:Back() end
- T:TurnRight()
- T:Forward()
- T:TurnLeft()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Forward()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T:Up()
- T:Forward()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T:Up()
- T:Up()
- T.placeDown()
- T:Forward()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T:Up()
- T:Up()
- T.placeDown()
- T:Forward()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T:Down()
- T.digDown()
- T.placeDown()
- T:Up()
- T.placeDown()
- T:Up()
- T.select(bucketslots[1])
- T.placeDown()
- T:Up()
- T.select(stoneslots[1])
- T.placeDown()
- for i = 1, 3 do T:Back() end
- local sx, sy, sz, sr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(Water.x, sy, Water.z)
- T:GoTo(Water.x, Water.y, Water.z)
- T.select(bucketslots[1])
- T.placeDown()
- T:GoTo(sx, sy, sz)
- T:TurnDirection(sr)
- T:Down()
- T.placeDown()
- T:Up()
- T.select(stoneslots[1])
- T.placeDown()
- end
- function Generate(count, slot)
- if T:getLava() then
- SaveFile("log", "Getting cobblestone from generator", true)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- for i = 1, 3 do T:Forward() end
- T:TurnLeft()
- for i = 1, 2 do T:Forward() end
- T.select(slot)
- while T.getItemCount(slot) < count do T.dig() end
- for i = 1, 2 do T:Back() end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- else
- SaveFile("log", "No lava found", true)
- error()
- end
- end
- function FixMine(N)
- local a = 22
- if N == 2 then
- a = 17
- elseif N == 3 then
- a = 12
- end
- GetModem()
- SaveFile("log", "Getting stone", true)
- local Stone, mess = T:GetItemFromChest("stone", "cobblestone", 63, 1)
- if not(Stone) then
- Generate(63, 1)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- while T:getY() > a do
- T:Down()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- while T:getY() >= (a-5) do
- for i = 1, 36 do
- T:Forward()
- end
- for I = 1, 18 do
- T.select(1)
- T:TurnLeft()
- SaveFile("log", "Fixing Mine Left", true)
- for i = 1, 18 do
- T.dig()
- T:Forward()
- T.select(1)
- if T:getY() == 22 then
- while T.digUp()do end
- T.placeUp()
- end
- T:TurnRight()
- T.dig()
- T.place()
- if I == 18 then
- for i = 1, 2 do
- T:TurnLeft()
- end
- T.dig()
- T.place()
- T:TurnRight()
- else
- T:TurnLeft()
- end
- end
- T.dig()
- T.place()
- SaveFile("log", "Back up", true)
- for i = 1, 18 do
- T:Back()
- end
- T:SortInvItems(1)
- local count, slots = T:LookInvItems("cobblestone", true)
- if count < 38 then
- local sx, sy, sz, sr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(Mine.x, sy, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- SortStorage(2)
- T:Refuel()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 63, 1)
- if not(Stone) then
- Generate(63, 1)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, sy, Mine.z)
- T:GoTo(sx, sy, sz)
- T:TurnDirection(sr)
- end
- for i = 1,2 do
- T:TurnRight()
- end
- SaveFile("log", "Fixing Mine Right", true)
- for i = 1, 18 do
- T.dig()
- T:Forward()
- T.select(1)
- if T:getY() == 22 then
- while T.digUp()do end
- T.placeUp()
- end
- T:TurnLeft()
- T.dig()
- T.place()
- if I == 18 then
- for i = 1, 2 do
- T:TurnRight()
- end
- T.dig()
- T.place()
- T:TurnLeft()
- else
- T:TurnRight()
- end
- end
- T.dig()
- T.place()
- SaveFile("log", "Back up", true)
- for i = 1, 18 do
- T:Back()
- end
- T:TurnLeft()
- if I == 1 then
- T.dig()
- T.place()
- end
- SaveFile("log", "Back up", true)
- for i = 1, 2 do
- T.select(1)
- if T:getY() == 22 then
- while T.digUp()do end
- T.placeUp()
- end
- T:Back()
- end
- T:SortInvItems(1)
- count, slots = T:LookInvItems("cobblestone", true)
- if count < 38 and I < 18 then
- local sx, sy, sz, sr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(Mine.x, sy, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- SortStorage(2)
- T:Refuel()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 63, 1)
- if not(Stone) then
- Generate(63, 1)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, sy, Mine.z)
- T:GoTo(sx, sy, sz)
- T:TurnDirection(sr)
- end
- end
- T:Down()
- end
- T:GoHome()
- SortStorage()
- T:Refuel()
- GetModem()
- if N == 1 then
- Status = 12
- elseif N == 2 then
- Status = 13
- elseif N == 3 then
- Status = 14
- end
- SaveFile("status")
- end
- function MakeSword(N)
- SaveFile("log", "Making Sword", true)
- local stick, mess = T:GetItemFromChest("wood", "stick", 1, 9)
- local craft = false
- if not(stick) then
- local planks, mess = T:GetItemFromChest("wood", "planks", 2, 4)
- if not(planks) then
- local logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- end
- T:Craft("planks", 2, "log")
- end
- T:Craft("stick", 1, "planks")
- craft = true
- GetChest()
- SortStorage()
- stick, mess = T:GetItemFromChest("wood", "stick", 1, 9)
- end
- local diamond, mess = T:GetItemFromChest("diamond", "diamond", 2, 5)
- if not(diamond) then
- SaveFile("log", mess, true)
- error()
- end
- local count, slots1 = T:LookInvItems("stick", true)
- local count, slots2 = T:LookInvItems("diamond", true)
- if slots1[1] ~= 9 then
- T.select(slots1[1])
- T.transferTo(9, 1)
- end
- if slots2[1] ~= 5 then
- T.select(slots2[1])
- T.transferTo(5, 2)
- count, slots2 = T:LookInvItems("diamond", true)
- end
- T.select(slots2[1])
- T.transferTo(1, 1)
- if not(craft) then
- GetChest()
- T.place()
- for i = 2, 4 do
- T.select(i)
- T.drop()
- end
- for i = 6, 8 do
- T.select(i)
- T.drop()
- end
- for i = 10, 16 do
- T.select(i)
- T.drop()
- end
- end
- T.select(4)
- T.craft()
- if not(craft) then
- while T.suck() do end
- T.select(chestSlot)
- T.dig()
- end
- GetChest()
- GetModem()
- SortStorage()
- if N == nil or N == 1 then
- Status = 15
- SaveFile("status")
- end
- end
- function MakePickAxe()
- SaveFile("log", "Making pickaxe", true)
- local stick, mess = T:GetItemFromChest("wood", "stick", 2, 10)
- local craft = false
- if not(stick) then
- local planks, mess = T:GetItemFromChest("wood", "planks", 2, 4)
- if not(planks) then
- local logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- end
- T:Craft("planks", 2, "log")
- end
- T:Craft("stick", 2, "planks")
- craft = true
- GetChest()
- SortStorage()
- stick, mess = T:GetItemFromChest("wood", "stick", 2, 9)
- end
- local diamond, mess = T:GetItemFromChest("diamond", "diamond", 3, 2)
- if not(diamond) then
- SaveFile("log", mess, true)
- error()
- end
- local count, slots1 = T:LookInvItems("stick", true)
- local count, slots2 = T:LookInvItems("diamond", true)
- if slots1[1] ~= 10 then
- T.select(slots1[1])
- T.transferTo(10, 2)
- count, slots1 = T:LookInvItems("stick", true)
- end
- T.select(slots1[1])
- T.transferTo(6, 1)
- if slots2[1] ~= 2 then
- T.select(slots2[1])
- T.transferTo(2, 3)
- count, slots2 = T:LookInvItems("diamond", true)
- end
- T.select(slots2[1])
- T.transferTo(1, 1)
- T.transferTo(3, 1)
- if not(craft) then
- GetChest()
- T.place()
- for i = 4, 5 do
- T.select(i)
- T.drop()
- end
- for i = 7, 9 do
- T.select(i)
- T.drop()
- end
- for i = 11, 16 do
- T.select(i)
- T.drop()
- end
- end
- T.select(4)
- T.craft()
- if not(craft) then
- while T.suck() do end
- T.select(chestSlot)
- T.dig()
- end
- GetChest()
- GetModem()
- SortStorage()
- end
- function AttackMobs(N)
- GetChest()
- GetModem()
- SaveFile("log", "Attacking Mobs for loot", true)
- local Stone, mess = T:GetItemFromChest("stone", "cobblestone", 40, 2)
- turtle.select(chestSlot)
- turtle.digUp()
- if not(Stone) then
- Generate(40, 2)
- end
- local sword, mess = T:GetItemFromChest("diamond", "diamond_sword", 1, 1)
- if not(sword) then
- MakeSword(2)
- sword, mess = T:GetItemFromChest("diamond", "diamond_sword", 1, 1)
- end
- T.select(1)
- T.equipLeft()
- T:GoTo(Mine.x, Mine.y, Mine.z)
- for I = 1, 2 do
- T:TurnLeft()
- end
- turtle.select(2)
- while not(T.detectDown()) do
- if T:getY() == 22 then
- T.placeUp()
- end
- T:Down()
- end
- while not(T.detect()) do
- while T.attack() do end
- T.placeDown()
- T:Forward()
- end
- for i = 1, 2 do
- T:TurnLeft()
- end
- T:GoTo(Mine.x, T:getY(), Mine.z)
- while T.attack() do end
- for i = 1, 2 do
- T:TurnLeft()
- end
- T:Forward()
- if N == nil or N == 1 or N == 3 then
- local bone = false
- while not(bone) do
- while T.attack() do end
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details and string.find(details.name, "bone") and details.count > 5 then
- bone = true
- end
- end
- end
- elseif N == 2 then
- local bone = false
- while not(bone) do
- while T.attack() do end
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details and string.find(details.name, "ender_pearl") and details.count > 5 then
- bone = true
- end
- end
- end
- end
- T:GoTo(Mine.x, T:getY(), Mine.z)
- while not(T.detectUp()) do
- T:Up()
- end
- T.select(1)
- T.equipLeft()
- T.digUp()
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SortStorage()
- T:Refuel()
- GetModem()
- if N == nil or N == 1 then
- Status = 16
- SaveFile("status")
- end
- end
- function MinetoBedRock()
- SaveFile("log", "Mine to BedRock", true)
- GetModem()
- local torches, mess = T:GetItemFromChest("wood", "torch", 64, 1)
- while not(torches) do
- if mess == "Cant find torch" then
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local count = math.ceil((64 - Torchnumber) / 4)
- for _ = 1, count do
- MakeTorches()
- T:Refuel()
- end
- SortStorage()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- elseif mess ~= nil then
- if mess == "Cant find chest for torch" then
- SaveFile("log", mess, true)
- error()
- end
- end
- end
- local Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- for I = 1, 2 do
- T:TurnLeft()
- end
- while T:getY() > 7 do
- T:Down()
- end
- local SY = T:getY()
- for i = 1, 36 do
- T:Forward()
- end
- T:TurnLeft()
- for i = 1, 18 do
- T:Forward()
- end
- for I = 1, 2 do
- T:TurnLeft()
- end
- T.select(1)
- local Succes, Detail = T.inspectDown()
- local a = 0
- while not(Succes) do
- T:Down()
- if T:getY() < 7 then
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- end
- Succes, Detail = T.inspectDown()
- end
- while Succes and Detail.name ~= "minecraft:bedrock" do
- T.digDown()
- T:Down()
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- Succes, Detail = T.inspectDown()
- end
- for b = 1, a do
- T.select(Stoneslots[1])
- T:Up()
- T.placeDown()
- end
- T:SortInvItems(2)
- Torchnumber, Torchslots = T:LookInvItems("torch", true)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- for i = 1, 34 do
- for I = 1, 36 do
- if (I%7) == 1 and (i%7) == 1 then
- Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local torchcount = T.getItemCount(Torchslots[1])
- if torchcount == 0 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- while not(torches) do
- if mess == "Cant find torch" then
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local count = math.ceil((64 - Torchnumber) / 4)
- for _ = 1, count do
- MakeTorches()
- T:Refuel()
- end
- SortStorage()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- elseif mess ~= nil then
- if mess == "Cant find chest for torch" then
- SaveFile("log", mess, true)
- error()
- end
- end
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- T.select(Torchslots[1])
- T:Up()
- T.placeDown()
- end
- T.select(1)
- while T.dig() do end
- T:Forward()
- while T:getY() > SY do
- T.digDown()
- T:Down()
- end
- while T:getY() < SY do
- while T.digUp() do end
- T:Up()
- end
- while T.digUp() do end
- Succes, Detail = T.inspectDown()
- a = 0
- while not(Succes) do
- T:Down()
- if T:getY() < 7 then
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- end
- Succes, Detail = T.inspectDown()
- end
- while Succes and Detail.name ~= "minecraft:bedrock" do
- T.digDown()
- T:Down()
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getX(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getZ() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- Succes, Detail = T.inspectDown()
- end
- for b = 1, a do
- T.select(Stoneslots[1])
- T:Up()
- T.placeDown()
- end
- end
- T:SortInvItems(2)
- Torchnumber, Torchslots = T:LookInvItems("torch", true)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- if (i%2) == 1 and i < 34 then
- if (i%7) == 1 then
- Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local torchcount = T.getItemCount(Torchslots[1])
- if torchcount == 0 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- while not(torches) do
- if mess == "Cant find torch" then
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local count = math.ceil((64 - Torchnumber) / 4)
- for _ = 1, count do
- MakeTorches()
- T:Refuel()
- end
- SortStorage()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- elseif mess ~= nil then
- if mess == "Cant find chest for torch" then
- SaveFile("log", mess, true)
- error()
- end
- end
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- T.select(Torchslots[1])
- T:Up()
- T.placeDown()
- end
- T:TurnRight()
- T.select(1)
- while T.dig() do end
- T:Forward()
- while T:getY() > SY do
- T.digDown()
- T:Down()
- end
- while T:getY() < SY do
- while T.digUp() do end
- T:Up()
- end
- while T.digUp() do end
- Succes, Detail = T.inspectDown()
- a = 0
- while not(Succes) do
- T:Down()
- if T:getY() < 7 then
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- end
- Succes, Detail = T.inspectDown()
- end
- while Succes and Detail.name ~= "minecraft:bedrock" do
- T.digDown()
- T:Down()
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- Succes, Detail = T.inspectDown()
- end
- for b = 1, a do
- T.select(Stoneslots[1])
- T:Up()
- T.placeDown()
- end
- T:TurnRight()
- elseif i < 34 then
- if (i%7) == 1 then
- Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local torchcount = T.getItemCount(Torchslots[1])
- if torchcount == 0 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- while not(torches) do
- if mess == "Cant find torch" then
- local Torchnumber, Torchslots = T:LookInvItems("torch", true)
- local count = math.ceil((64 - Torchnumber) / 4)
- for _ = 1, count do
- MakeTorches()
- T:Refuel()
- end
- SortStorage()
- GetModem()
- torches, mess = T:GetItemFromChest("wood", "torch", 64, 4)
- elseif mess ~= nil then
- if mess == "Cant find chest for torch" then
- SaveFile("log", mess, true)
- error()
- end
- end
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- T.select(Torchslots[1])
- T:Up()
- T.placeDown()
- end
- T:TurnLeft()
- T.select(1)
- while T.dig() do end
- T:Forward()
- while T:getY() > SY do
- T.digDown()
- T:Down()
- end
- while T:getY() < SY do
- while T.digUp() do end
- T:Up()
- end
- while T.digUp() do end
- Succes, Detail = T.inspectDown()
- a = 0
- while not(Succes) do
- T:Down()
- if T:getY() < 7 then
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- end
- Succes, Detail = T.inspectDown()
- end
- while Succes and Detail.name ~= "minecraft:bedrock" do
- T.digDown()
- T:Down()
- a = T:Add(a, 1)
- checkForOre()
- T.select(Stoneslots[1])
- T:SortInvItems(2)
- Stonenumber, Stoneslots = T:LookInvItems("cobblestone", true)
- local stonecount = T.getItemCount(Stoneslots[1])
- if stonecount < 10 then
- local ssx, ssy, ssz, ssr = T:getX(), T:getY(), T:getZ(), T:getR()
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:TurnLeft()
- local succes1 = T.detect()
- for _ = 1, 2 do T:TurnRight() end
- local succes2 = T.detect()
- T:TurnLeft()
- if succes1 or succes2 then
- local sxx, szz = T:getx(), T:getZ()
- T:Forward()
- if T:getX() == sxx then
- T:GoTo(sxx, SY+1, ssz)
- elseif T:getz() == szz then
- T:GoTo(ssx, SY+1, szz)
- end
- end
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Refuel()
- GetChest()
- GetModem()
- Stone, mess = T:GetItemFromChest("stone", "cobblestone", 32, 2)
- if not(Stone) then
- Generate(32, 2)
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(Mine.x, SY+1, Mine.z)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY+1, ssz)
- T:GoTo(ssx, SY, ssz)
- T:GoTo(ssx, ssy, ssz)
- T:TurnDirection(ssr)
- end
- for b = 1, 4 do
- T:TurnLeft()
- T.place()
- end
- T.select(1)
- Succes, Detail = T.inspectDown()
- end
- for b = 1, a do
- T.select(Stoneslots[1])
- T:Up()
- T.placeDown()
- end
- T:TurnLeft()
- end
- end
- T:SortInvItems(1)
- T:GoHome()
- SortStorage()
- T:Refuel()
- GetModem()
- Status = 17
- SaveFile("status")
- end
- function MakeLadder() -- 7 sticks = 3 ladders -- 2 planks = 4 sticks -- 1 log = 4 planks
- SaveFile("log", "Making Ladder", true)
- local stick, mess = T:GetItemFromChest("wood", "stick", 7, 4)
- if not(stick) then
- local planks, mess = T:GetItemFromChest("wood", "planks", 4, 4)
- if not(planks) then
- local logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 1, 4)
- end
- T:Craft("planks", 4, "log")
- end
- T:Craft("stick", 7, "planks")
- end
- T:Craft("ladder", 3, "stick")
- GetChest()
- end
- function PlaceLadder()
- SaveFile("log", "Getting Ladder", true)
- local ladder, mess, N = T:GetItemFromChest("wood", "ladder", 63, 4)
- while not(ladder) do
- N = math.ceil((63 - N) / 3)
- for _ = 1, N do
- MakeLadder()
- end
- GetModem()
- SortStorage(2)
- ladder, mess, N = T:GetItemFromChest("wood", "ladder", 63, 4)
- end
- SaveFile("log", "Getting Cobblestone", true)
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 64, 8)
- if not(stone) then
- Generate(64, 8)
- end
- local stonenumber, stoneslots = T:LookInvItems("cobblestone", true)
- local laddernumber, ladderslots = T:LookInvItems("ladder", true)
- SaveFile("log", "Placeing Cobblestone", true)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Up()
- T:Forward()
- T.select(stoneslots[1])
- while T:getY() > 7 do
- T.digDown()
- T:Down()
- T.dig()
- T.place()
- T:TurnLeft()
- T.dig()
- T.place()
- for i = 1, 2 do
- T:TurnRight()
- end
- T.dig()
- T.place()
- T:TurnLeft()
- end
- T:Back()
- T.select(ladderslots[1])
- SaveFile("log", "Placeing Ladder", true)
- while T:getY() < (Mine.y + 1) do
- T.place()
- T:Up()
- end
- SortStorage()
- T:Refuel()
- GetModem()
- Status = 18
- SaveFile("status")
- end
- function MakeShaft()
- SaveFile("log", "Getting Cobblestone", true)
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 64, 8)
- if not(stone) then
- Generate(64, 8)
- end
- local stonenumber, stoneslots = T:LookInvItems("cobblestone", true)
- SaveFile("log", "Makeing Mine Shaft", true)
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:Down()
- for i = 1, 2 do T:TurnRight() end
- T.select(stoneslots[1])
- while T:getY() > 22 do
- T.dig()
- T.place()
- T:TurnLeft()
- T.dig()
- T.place()
- for i = 1, 2 do T:TurnRight() end
- T.dig()
- T.place()
- T:TurnLeft()
- T:Down()
- end
- T:TurnLeft()
- while T:getY() > 7 do
- T.dig()
- T.place()
- for i = 1, 2 do T:TurnRight() end
- T.dig()
- T.place()
- for i = 1, 2 do T:TurnLeft() end
- T:Down()
- end
- T:GoTo(Mine.x, Mine.y, Mine.z)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SortStorage()
- T:Refuel()
- GetModem()
- Status = 19
- SaveFile("status")
- end
- function SandInspect()
- local succes, details = T.inspectDown()
- if succes and details.name == ("minecraft:sand" or "minecraft:red_sand") then
- T.digDown()
- T:Down()
- SandInspect()
- T:Up()
- end
- for i = 1, 4 do
- succes, details = T.inspect()
- if succes and details.name == ("minecraft:sand" or "minecraft:red_sand") then
- T.dig()
- T:Forward()
- SandInspect()
- T:Back()
- end
- T:TurnLeft()
- end
- end
- function GetSand(count, slot)
- SaveFile("log", "Getting Sand", true)
- T:GoTo(T:getX(), 100, T:getZ())
- T:GoTo(Sand.x, 100, Sand.z)
- T:GoTo(Sand.x, Sand.y, Sand.z)
- T.select(slot)
- SandInspect()
- if T.getItemCount(slot) < count then
- local a = 1
- while T.getItemCount(slot) < count do
- for j = 1, 2 do
- for I = 1, a do
- T:Forward()
- SandInspect()
- end
- T:TurnRight()
- end
- a = T:Add(a, 1)
- end
- Sand.x, Sand.y, Sand.z = T:getX(), T:getY(), T:getZ()
- SaveFile("locations")
- end
- end
- function MakeSugarCaneFarm()
- GetBucket()
- local sand, mess = T:GetItemFromChest("sand", "sand", 5, 8)
- if not(sand) then
- GetSand(5, 8)
- end
- local sugar, mess = T:GetItemFromChest("sand", "sugar_cane", 5, 4)
- if not(sugar) then
- SaveFile("log", mess, true)
- error()
- end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- T:TurnRight()
- for i = 1, 3 do
- T.dig()
- T:Forward()
- T:checkUp()
- end
- for i = 1, 5 do
- local sx, sy, sz, sr = T:getX(), T:getY(), T:getZ(), T:getR()
- T.select(bucketSlot)
- T:GoTo(T:getX(), 100, T:getZ())
- T:GoTo(Water.x, 100, Water.z)
- T:GoTo(Water.x, Water.y, Water.z)
- T.placeDown()
- T:GoTo(T:getX(), 100, T:getZ())
- T:GoTo(sx, 100, sz)
- T:GoTo(sx, sy, sz)
- T:TurnDirection(sr)
- T.digDown()
- T.placeDown()
- if i < 5 then
- T.dig()
- T:Forward()
- T:checkUp()
- end
- end
- T:TurnRight()
- T.dig()
- T:Forward()
- T:checkUp()
- T:TurnRight()
- for i = 1, 5 do
- T.select(8)
- T.digDown()
- T.placeDown()
- T:Up()
- T.select(4)
- T.placeDown()
- if i < 5 then
- T.dig()
- T:Forward()
- T:checkUp()
- T.digDown()
- T:Down()
- end
- end
- SortStorage()
- T:Refuel()
- GetModem()
- end
- function GetSugarCane()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- T:Back()
- T:TurnRight()
- for i = 1, 2 do T:Forward() end
- local succes, details = T.inspect()
- if not(succes) or (succes and details.name ~= "minecraft:sugar_cane") then
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- MakeSugarCaneFarm()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- T:Back()
- T:TurnRight()
- for i = 1, 2 do T:Forward() end
- end
- for i = 1, 3 do T:Up() end
- T:Forward()
- for i = 1, 5 do
- local succes, details = T.inspectDown()
- while not(succes) do
- sleep(5)
- succes, details = T.inspectDown()
- end
- if succes then
- T.digDown()
- T:Down()
- T.digDown()
- T:Up()
- end
- if i < 5 then
- T:Forward()
- end
- end
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- SortStorage()
- T:Refuel()
- GetModem()
- end
- function MakeGlass()
- local logs, mess = T:GetItemFromChest("wood", "log", 4, 4)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 4, 4)
- end
- local sand, mess = T:GetItemFromChest("sand", "sand", 6, 8)
- if not(sand) then
- GetSand(6, 8)
- end
- T:GoHome()
- for i = 1, 2 do T:Up() end
- for i = 1, 2 do T:Forward() end
- local logcount, logslots = T:LookInvItems("log", true)
- local sandcount, sandslots = T:LookInvItems("sand", true)
- T.select(sandslots[1])
- T.dropDown(6)
- T:Back()
- T:Down()
- T.select(logslots[1])
- T.drop(4)
- T:Down()
- T:Forward()
- sleep(60)
- while T.suckUp() do end
- SortStorage()
- GetChest()
- GetModem()
- end
- function MakeGlasPane()
- local glas, mess = T:GetItemFromChest("sand", "glas", 6, 4)
- while not(glas) do
- MakeGlass()
- glas, mess = T:GetItemFromChest("sand", "glas", 6, 4)
- end
- local glascount, glasslots = T:LookInvItems("glas", true)
- T.select(glasslots[1])
- T.transferTo(1,1)
- T.transferTo(2,1)
- T.transferTo(3,1)
- T.transferTo(5,1)
- T.transferTo(6,1)
- T.transferTo(7,1)
- T.dropDown()
- T.select(8)
- T.dropDown()
- T.select(9)
- T.dropDown()
- T.select(10)
- T.dropDown()
- T.select(11)
- T.dropDown()
- T.select(12)
- T.dropDown()
- T.select(13)
- T.dropDown()
- T.select(14)
- T.dropDown()
- T.select(15)
- T.dropDown()
- T.select(16)
- T.dropDown()
- T.select(glasslots[1])
- T.craft()
- GetChest()
- GetModem()
- SortStorage()
- end
- function ProgramDisk()
- local diskdrive, mess = T:GetItemFromChest("rest", "computercraft:disk_drive", 1, 1, false)
- local Disk, mess = T:GetItemFromChest("rest", "computercraft:disk", 1, 2, false)
- T.select(1)
- T.place()
- T.select(2)
- T.drop()
- disk.setLabel("front", "Turle_Setup")
- local file = fs.open("disk/startup.lua", "w")
- file.write('shell.run("pastebin get V2Cv9a0M /SelfRep.lua")')
- file.close()
- T.suck()
- T.select(1)
- T.dig()
- end
- function CraftDiskDive()
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 7, 1)
- if not(stone) then
- Generate(7, 1)
- end
- local logs, mess = T:GetItemFromChest("wood", "log", 5, 8)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 6, 8)
- end
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T:Back()
- for i = 1, 2 do T:Up() end
- T:Forward()
- T.select(1)
- T.dropDown()
- T:Back()
- T:Down()
- T.select(8)
- T.drop()
- T:Down()
- T:Forward()
- T.select(1)
- sleep(70)
- while T.suckUp() do sleep(5) end
- T.transferTo(2,1)
- T.transferTo(3,1)
- T.transferTo(5,1)
- T.transferTo(7,1)
- T.transferTo(9,1)
- T.transferTo(11,1)
- local redstone, mess = T:GetItemFromChest("redstone", "redstone", 2, 6)
- T.select(6)
- T.transferTo(10,1)
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T.select(chestSlot)
- T.dropDown()
- T.select(modemSlot)
- T.dropDown()
- T.craft()
- T.dropDown()
- GetChest()
- GetModem()
- SortStorage(2)
- local dye, mess = T:GetItemFromChest("rest", "minecraft:white_dye", 1, 5)
- if not(dye) then
- local meal, mess = T:GetItemFromChest("sapling", "minecraft:bone_meal", 1, 5)
- if not(meal) then
- local bone, mess = T:GetItemFromChest("sapling", "minecraft:bone", 1, 4)
- while not(bone) do
- AttackMobs(3)
- bone, mess = T:GetItemFromChest("sapling", "minecraft:bone", 1, 4)
- end
- T:Craft("bone_meal", 1, "bone")
- end
- T:Craft("white_dye", 1, "bone_meal")
- end
- T.select(5)
- T.dropDown()
- GetChest()
- GetModem()
- SortStorage(2)
- local paper, mess = T:GetItemFromChest("sand", "paper", 1, 2)
- if not(paper) then
- local sugar, mess = T:GetItemFromChest("sand", "sugar_cane", 3, 4)
- if not(sugar) then
- GetSugarCane()
- sugar, mess = T:GetItemFromChest("sand", "sugar_cane", 3, 4)
- end
- T:Craft("paper", 1, "sugar_cane")
- end
- T.select(2)
- T.dropDown()
- GetChest()
- GetModem()
- SortStorage(2)
- local bone, mess = T:GetItemFromChest("rest", "minecraft:white_dye", 1, 5)
- local paper, mess = T:GetItemFromChest("sand", "paper", 1, 2)
- local redstone, mess = T:GetItemFromChest("redstone", "redstone", 1, 1)
- T:GoTo(Chests[1])
- for i = 3, 4 do
- T.select(i)
- T.dropDown()
- end
- for i = 6, 16 do
- T.select(i)
- T.dropDown()
- end
- T.craft()
- GetChest()
- T:Refuel()
- GetModem()
- SortStorage(2)
- ProgramDisk()
- SortStorage()
- Status = 20
- SaveFile("status")
- end
- function CraftTurtle()
- GetChest()
- GetModem()
- SaveFile("log", "Craft Turtle", true)
- MakePickAxe()
- GetChest()
- GetModem()
- local logs, mess = T:GetItemFromChest("wood", "log", 20, 8)
- while not(logs) do
- HarvestTreeFarm()
- logs, mess = T:GetItemFromChest("wood", "log", 20, 8)
- end
- GetChest()
- GetModem()
- SortStorage(2)
- logs, mess = T:GetItemFromChest("wood", "log", 1, 1)
- T:Craft("planks", 4, "log")
- GetChest()
- GetModem()
- SortStorage(2)
- logs, mess = T:GetItemFromChest("wood", "planks", 4, 4)
- local planksnumber, planksslots = T:LookInvItems("planks", true)
- T.select(planksslots[1])
- T.transferTo(1,1)
- T.transferTo(2,1)
- T.transferTo(5,1)
- T.transferTo(6,1)
- for i = 3, 4 do
- T.select(i)
- T.dropDown()
- end
- for i = 7, 16 do
- T.select(i)
- T.dropDown()
- end
- T.craft()
- GetChest()
- GetModem()
- SortStorage(2)
- local glas, mess = T:GetItemFromChest("sand", "glass_pane", 1, 10)
- while not(glas) do
- MakeGlasPane()
- glas, mess = T:GetItemFromChest("sand", "glass_pane", 1, 10)
- end
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 7, 1)
- if not(stone) then
- Generate(7, 1)
- end
- logs, mess = T:GetItemFromChest("wood", "log", 5, 8)
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T:Back()
- for i = 1, 2 do T:Up() end
- T:Forward()
- T.select(1)
- T.dropDown()
- T:Back()
- T:Down()
- T.select(8)
- T.drop()
- T:Down()
- T:Forward()
- T.select(1)
- sleep(70)
- while T.suckUp() do sleep(5) end
- T.transferTo(2,1)
- T.transferTo(3,1)
- T.transferTo(5,1)
- T.transferTo(7,1)
- T.transferTo(9,1)
- T.transferTo(11,1)
- local redstone, mess = T:GetItemFromChest("redstone", "redstone", 1, 6)
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T.select(chestSlot)
- T.dropDown()
- T.select(modemSlot)
- T.dropDown()
- T.craft()
- T.dropDown()
- GetChest()
- GetModem()
- SortStorage(2)
- local pearl, mess = T:GetItemFromChest("rest", "ender_pearl", 1, 6)
- while not(pearl) do
- AttackMobs(2)
- pearl, mess = T:GetItemFromChest("rest", "ender_pearl", 1, 6)
- end
- local stone, mess = T:GetItemFromChest("stone", "cobblestone", 8, 1)
- if not(stone) then
- Generate(8, 1)
- end
- logs, mess = T:GetItemFromChest("wood", "log", 6, 8)
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T:Back()
- for i = 1, 2 do T:Up() end
- T:Forward()
- T.select(1)
- T.dropDown()
- T:Back()
- T:Down()
- T.select(8)
- T.drop()
- T:Down()
- T:Forward()
- T.select(1)
- sleep(80)
- while T.suckUp() do sleep(5) end
- T.transferTo(2,1)
- T.transferTo(3,1)
- T.transferTo(5,1)
- T.transferTo(7,1)
- T.transferTo(9,1)
- T.transferTo(10,1)
- T.transferTo(11,1)
- T.select(4)
- T.dropDown()
- T.select(8)
- T.dropDown()
- for i = 12, 16 do
- T.select(i)
- T.dropDown()
- end
- T.craft()
- GetChest()
- GetModem()
- SortStorage(2)
- local iron, mess = T:GetItemFromChest("iron", "iron_ore", 7, 4)
- if not(iron) then
- SaveFile("log", mess, true)
- error()
- end
- logs, mess = T:GetItemFromChest("wood", "log", 5, 8)
- T:GoTo(Chests[1])
- for i = 1, 2 do T:TurnLeft() end
- T:Back()
- for i = 1, 2 do T:Up() end
- T:Forward()
- T.select(4)
- T.dropDown()
- T:Back()
- T:Down()
- T.select(8)
- T.drop()
- T:Down()
- T:Forward()
- T.select(4)
- sleep(70)
- while T.suckUp() do sleep(5) end
- GetChest()
- GetModem()
- SortStorage(2)
- logs, mess = T:GetItemFromChest("wood", "log", 2, 4)
- T:Craft("planks", 8, "log")
- T:Craft("chest", 1, "planks")
- GetChest()
- GetModem()
- SortStorage(2)
- local iron, mess = T:GetItemFromChest("iron", "iron_ingot", 7, 1)
- local chest, mess1 = T:GetItemFromChest("rest", "chest", 1, 10)
- local computer, mess2 = T:GetItemFromChest("rest", "computercraft:computer", 1, 6)
- if not(iron) then
- SaveFile("log", mess, true)
- error()
- end
- if not(chest) then
- SaveFile("log", mess1, true)
- error()
- end
- if not(computer) then
- SaveFile("log", mess2, true)
- error()
- end
- T.select(1)
- T.transferTo(2,1)
- T.transferTo(3,1)
- T.transferTo(5,1)
- T.transferTo(7,1)
- T.transferTo(9,1)
- T.transferTo(11,1)
- T.select(4)
- T.dropDown()
- T.select(8)
- T.dropDown()
- for i = 12, 16 do
- T.select(i)
- T.dropDown()
- end
- T.craft()
- GetChest()
- GetModem()
- SortStorage(2)
- local computer, mess2 = T:GetItemFromChest("diamond", "pickaxe", 1, 3)
- local iron, mess = T:GetItemFromChest("rest", "modem", 1, 1)
- local chest, mess1 = T:GetItemFromChest("rest", "turtle", 1, 2)
- for i = 4, 16 do
- T.select(i)
- T.dropDown()
- end
- T.select(4)
- T.craft()
- GetChest()
- GetModem()
- SortStorage(2)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- end
- function ProgramTurtle()
- GetChest()
- GetModem()
- SaveFile("log", "Programming Turtle", true)
- local Turtle, mess = T:GetItemFromChest("rest", "turtle", 1, 1)
- local Disk_drive, mess = T:GetItemFromChest("rest", "computercraft:disk_drive", 1, 2, false)
- local Disk, mess = T:GetItemFromChest("rest", "computercraft:disk", 1, 3, false)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:Up()
- T:Forward()
- for _ = 1, 2 do T:TurnRight() end
- T.select(1)
- T.placeDown()
- T:Forward()
- T:Down()
- for _ = 1, 2 do T:TurnRight() end
- local newTurtle = Per.wrap("front")
- local on = newTurtle.isOn()
- if not(on) then
- newTurtle.turnOn()
- elseif on then
- newTurtle.reboot()
- end
- T:Up()
- T.select(2)
- T.place()
- T.select(3)
- T.drop()
- T:Down()
- newTurtle = Per.wrap("front")
- local on = newTurtle.isOn()
- if not(on) then
- newTurtle.turnOn()
- elseif on then
- newTurtle.reboot()
- end
- sleep(5)
- T:Up()
- T.suck()
- T.dig()
- T:Down()
- newTurtle = Per.wrap("front")
- on = newTurtle.isOn()
- if on then
- newTurtle.shutdown()
- end
- T.dig()
- T:Refuel()
- SortStorage()
- GetChest()
- GetModem()
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- end
- function GetBucket()
- T:GoTo(Chests[1])
- T.select(1)
- while T.suckDown() do end
- local Details = T.getItemDetail(bucketSlot)
- if Details and not(string.find(Details.name, "bucket")) then
- T.select(bucketSlot)
- T.dropDown()
- end
- Details = T.getItemDetail(chestSlot)
- if Details and not(string.find(Details.name, "chest")) then
- T.select(chestSlot)
- T.dropDown()
- end
- local chest, bucket = false, false
- for i = 1, 13 do
- Details = T.getItemDetail(i)
- T.select(i)
- if Details and string.find(Details.name, "chest") and not(chest) then
- T.transferTo(chestSlot, 1)
- chest = true
- T.dropDown()
- elseif Details and string.find(Details.name, "bucket") and not(bucket) then
- T.transferTo(bucketSlot, 1)
- bucket = true
- T.dropDown()
- else
- T.dropDown()
- end
- end
- Details = T.getItemDetail(bucketSlot)
- if Details and not(string.find(Details.name, "bucket")) and not(bucket) then
- GetChest()
- T.select(chestSlot)
- T.place()
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- T.select(bucketSlot)
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details and string.find(Details.name, "bucket") and not(bucket) then
- chest1.pushItems("front", i, 1)
- bucket = true
- elseif bucket then
- break
- end
- end
- T.suck()
- T.select(chestSlot)
- T.dig()
- end
- T.select(1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- if not(bucket) then
- MakeBucket()
- SortStorage()
- GetBucket()
- end
- end
- function GetModem()
- local details = T.getItemDetail(modemSlot)
- local findmodem = false
- if details and string.find(details.name, "modem") then
- findmodem = true
- else
- if Status > 2 then
- T.select(modemSlot)
- T.drop()
- T.select(1)
- for i = 1, 16 do
- local Details = T.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- T.select(i)
- T.transferTo(modemSlot, 1)
- findmodem = true
- end
- end
- end
- T.select(1)
- if not(findmodem) then
- for g = 1, #Chests do
- if Chests[g].X then
- T:GoTo(Chests[g])
- GetChest()
- T.select(chestSlot)
- local side = "front"
- if g == 9 then
- T.placeUp()
- side = "top"
- else
- T.place()
- side = "front"
- end
- local chest1 = Per.wrap("bottom")
- local size1 = chest1.size()
- for i = 1, size1 do
- local Details = chest1.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- chest1.pushItems(side, i, 1)
- findmodem = true
- break
- end
- end
- end
- T.select(modemSlot)
- if g == 9 then
- while T.suckUp() do end
- else
- while T.suck() do end
- end
- T.select(chestSlot)
- if g == 9 then
- T.digUp()
- else
- T.dig()
- end
- if findmodem == true then break end
- end
- end
- T.select(1)
- T:GoTo(T:getHomeX(), T:getHomeY(), T:getHomeZ())
- T:TurnDirection(T:getHomeR())
- end
- else
- T.select(modemSlot)
- T.drop()
- T.select(1)
- for i = 1, 16 do
- local Details = T.getItemDetail(i)
- if Details then
- if string.find(Details.name, "modem") then
- T.select(i)
- T.transferTo(modemSlot, 1)
- findmodem = true
- end
- end
- end
- T.select(1)
- end
- end
- if not(findmodem) then
- SaveFile("log", "No modem found", true)
- error()
- end
- end
- function GetChest()
- local sx,sy,sz,sr = T:getX(), T:getY(), T:getZ(), T:getR()
- T.select(1)
- local findchest = false
- local details = T.getItemDetail(chestSlot)
- if details and string.find(details.name, "chest") then
- findchest = true
- T.select(chestSlot)
- else
- if details and not(string.find(details.name, "chest")) then
- T.select(chestSlot)
- T.dropDown()
- T.select(1)
- end
- if Status > 2 and not(findchest) then
- for i = 1, 15 do
- details = T.getItemDetail(i)
- if details and string.find(details.name, "chest") then
- T.select(i)
- T.transferTo(chestSlot,1)
- T.select(chestSlot)
- findchest = true
- end
- if findchest == true then break end
- end
- if not(findchest) then
- for g = 1, #Chests do
- if Chests[g].X then
- T:GoTo(Chests[g])
- T.select(1)
- while T.suckDown() do end
- details = T.getItemDetail(chestSlot)
- if details and not(string.find(details.name, "chest")) then
- T.select(chestSlot)
- T.dropDown()
- T.select(1)
- end
- for i = 1, 15 do
- details = T.getItemDetail(i)
- if details and string.find(details.name, "chest") then
- T.select(i)
- T.transferTo(chestSlot,1)
- T.select(chestSlot)
- findchest = true
- elseif details then
- T.select(i)
- T.dropDown()
- end
- end
- T.select(chestSlot)
- if findchest == true then break end
- end
- end
- T:GoTo(sx, sy, sz)
- T:TurnDirection(sr)
- end
- elseif not(findchest) then
- details = T.getItemDetail(chestSlot)
- if details and not(string.find(details.name, "chest")) then
- T.select(chestSlot)
- T.dropDown()
- T.select(1)
- end
- for i = 1, 15 do
- details = T.getItemDetail(i)
- if details and string.find(details.name, "chest") then
- T.select(i)
- T.transferTo(chestSlot,1)
- T.select(chestSlot)
- findchest = true
- elseif details then
- T.select(i)
- T.dropDown()
- end
- T.select(chestSlot)
- if findchest == true then break end
- end
- end
- end
- if not(findchest) then
- SaveFile("log", "No chest found", true)
- error()
- end
- end
- if T.getFuelLevel() < 500 and Status > 5 then
- T:Refuel()
- elseif T.getFuelLevel() < 500 and Status <= 5 then
- local succes, Succes = {}, false
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, T.refuel())
- end
- T.select(1)
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- while not(Succes) do
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- end
- end
- if T:getX() ~= T:getHomeX() or T:getY() ~= T:getHomeY() or T:getZ() ~= T:getHomeZ() or T:getR() ~= T:getHomeR() then
- -- gohome
- if T.getFuelLevel() < 500 and Status > 5 then
- T:Refuel()
- elseif T.getFuelLevel() < 500 and Status <= 5 then
- local succes, Succes = {}, false
- for i = 1, 13 do
- T.select(i)
- table.insert(succes, T.refuel())
- end
- T.select(1)
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- while not(Succes) do
- local succes1, details = T.inspect()
- succes = {}
- if succes1 then
- if string.find(details.name, "log") then
- T.dig()
- table.insert(succes, T.refuel())
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- else
- print("X")
- SaveFile("log", "Cant refuel", true)
- error()
- end
- for i = 1, succes do
- if succes[i] then
- Succes = true
- end
- end
- end
- end
- T:GoHome()
- end
- Monitor[0].write("Want to load from Status "..Status.."? Y/N: ")
- local event, Answer, p2 = System.pullEvent("key")
- if Answer == keys.n then
- print("N")
- SaveFile("log", "Want to load from Status "..Status.."? Y/N: N", false)
- SaveFile("log", "Get a Total Reset: ", true)
- local file = fs.exists("/HomeCor.txt")
- if file then fs.delete("/.HomeCor.txt") end
- file = fs.exists("/.Locations.lo")
- if file then fs.delete("/.Locations.lo") end
- file = fs.exists("/.Chests.ch")
- if file then fs.delete("/.Chests.ch") end
- file = fs.exists("/.Status.st")
- if file then fs.delete("/.Status.st") end
- System.reboot()
- else
- print("Y")
- SaveFile("log", "Want to load from Status "..Status.."? Y/N: Y", false)
- end
- file = fs.exists("/.Locations.lo")
- if file then
- SaveFile("log", "Loading Locations", true)
- file = fs.open("/.Locations.lo", "r")
- local Data = UnPack(file.readAll())
- file.close()
- if Data.Water then
- Water = Data.Water
- end
- if Data.Sand then
- Sand = Data.Sand
- end
- if Data.Mine then
- Mine = Data.Mine
- end
- if Data.Lava then
- T:setLava(Data.Lava)
- end
- SaveFile("log", "Loaded Locations", true)
- end
- file = fs.exists("/.Chests.ch")
- if file then
- SaveFile("log", "Loading chests", true)
- file = fs.open("/.Chests.ch", "r")
- local Data = UnPack(file.readAll())
- file.close()
- Chests = Data
- SaveFile("log", "Loaded chests", true)
- end
- if Status > 2 then
- SaveFile("log", "Looking for Tool: "..Tools[3], true)
- for i = 1, 2 do
- T:Forward()
- end
- T.select(13)
- Toolequip()
- T.select(1)
- while T.suckDown() do end
- EquipRight = false
- for i = 1, 16 do
- local details = T.getItemDetail(i)
- if details then
- for _, name in ipairs(Tools) do
- if details.name == name then
- if details.name == Tools[3] then
- T.select(i)
- EquipRight = Toolequip()
- end
- end
- end
- end
- end
- for i = 1, 16 do
- if T.getItemDetail(i) ~= nil and not(string.find(T.getItemDetail(i).name, "chest")) then
- T.select(i)
- T.dropDown()
- end
- end
- for i = 1, 15 do
- if T.getItemDetail(i) ~= nil and string.find(T.getItemDetail(i).name, "chest") then
- T.select(i)
- T.transferTo(chestSlot, 1)
- end
- end
- for i = 1, 15 do
- T.select(i)
- T.dropDown()
- end
- for i = 1, 2 do
- T:Back()
- end
- GetModem()
- if not(EquipRight)then
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- SaveFile("log", "Tool not found : "..Tools[3], true)
- error()
- end
- end
- T.select(1)
- if Status >= 6 then
- SortStorage(0)
- if T.getFuelLevel() < 500 then
- T:Refuel()
- end
- GetModem()
- end
- function Main()
- if Status == 1 then
- FirstTree()
- end
- if Status == 2 then
- MakeChest()
- end
- if Status == 3 then
- HarvestAllTrees()
- end
- if Status == 4 then
- GetCobbleStone()
- end
- if Status == 5 then
- MakeStorage()
- end
- if Status == 6 then
- T:Refuel()
- GetModem()
- Makefurnace()
- MakeBucket()
- MakeSaplingChest()
- end
- if Status == 7 then
- T:Refuel()
- SortStorage()
- GetModem()
- T.select(1)
- MakeHopper()
- MakeTorches()
- T:emptyInv()
- SortStorage()
- T:Refuel()
- GetBucket()
- MakeTreeFarm()
- SortStorage()
- end
- if Status == 8 then
- T:Refuel()
- GoMine(1)
- end
- if Status == 9 then
- T:Refuel()
- GoMine(2)
- end
- if Status == 10 then
- T:Refuel()
- GoMine(3)
- if T:getLava() then
- MakeGenerate()
- end
- Status = 11
- SaveFile("status")
- end
- if Status == 11 then
- T:Refuel()
- FixMine(1)
- end
- if Status == 12 then
- T:Refuel()
- FixMine(2)
- end
- if Status == 13 then
- T:Refuel()
- FixMine(3)
- end
- if Status == 14 then
- T:Refuel()
- MakeSword()
- end
- if Status == 15 then
- T:Refuel()
- T:GetItemFromChest("rest", "ender_pearl", 64, 3)
- AttackMobs(2)
- T:GetItemFromChest("sapling", "bone", 64, 3)
- AttackMobs()
- end
- if Status == 16 then
- T:Refuel()
- MinetoBedRock()
- end
- if Status == 17 then
- T:Refuel()
- PlaceLadder()
- end
- if Status == 18 then
- T:Refuel()
- MakeShaft()
- end
- if Status == 19 then
- T:Refuel()
- CraftDiskDive()
- end
- if Status == 20 then
- CraftTurtle()
- ProgramTurtle()
- end
- end
- Main()
Add Comment
Please, Sign In to add comment