Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local station = 0
- --return station[0]
- --washing station[1]
- --press station[2]
- --pickup station[3]
- function MoveToWash()
- if station == 0 then
- turtle.turnRight()
- elseif station == 2 then
- turtle.turnLeft()
- elseif station == 3 then
- turtle.turnRight()
- turtle.turnRight()
- end
- station = 1
- sleep(0.3)
- end
- function MoveToPress()
- if station == 0 then
- turtle.turnRight()
- turtle.turnRight()
- elseif station == 1 then
- turtle.turnRight()
- elseif station == 3 then
- turtle.turnLeft()
- end
- station = 2
- sleep(0.3)
- end
- function MoveToPickUp()
- if station == 0 then
- turtle.turnLeft()
- elseif station ==1 then
- turtle.turnLeft()
- turtle.turnLeft()
- elseif station == 2 then
- turtle.turnRight()
- end
- station = 3
- sleep(0.3)
- end
- function MoveToReturn()
- if station == 1 then
- turtle.left()
- elseif station == 2 then
- turtle.left()
- turtle.left()
- elseif station == 3 then
- turtle.turnRight()
- end
- station = 0
- sleep(0.3)
- end
- function FindLastFreeSlot()
- local slot = 0
- for i = 1, 16, 1 do
- if turtle.getItemCount(i) == 0 then
- return i
- end
- end
- return 16
- end
- function SuckUpItemsFromChest()
- MoveToReturn()
- for i = 1, 16, 1 do
- turtle.suck()
- end
- end
- function ReturnAllItems()
- MoveToReturn()
- for i = 1, 16, 1 do
- turtle.select(i)
- turtle.drop()
- end
- end
- function FindName(str)
- local strlength = string.len(str)
- end
- function TempStorage()
- local HowManyItemsAreInThere = 0
- for i = 1, 16, 1 do
- if turtle.getItemCount(i)>0 then
- local b = turtle.getItemDetail(i)
- if string.find(b.name,"crushed") then
- turtle.select(i)
- turtle.dropUp()
- HowManyItemsAreInThere = HowManyItemsAreInThere + 1
- end
- end
- end
- turtle.select(1)
- return HowManyItemsAreInThere
- end
- function GrindItems(LastItemSlot)
- local TimeToSleep
- for i = 1, LastItemSlot, 1 do
- if turtle.getItemCount(i)>0 then
- TimeToSleep = turtle.getItemCount(i) * 4
- turtle.select(i)
- local b = turtle.getItemDetail(i)
- print("attempting to crush " , b.name)
- if string.find(b.name,"crushed") then
- print("attempt unsuccessful")
- else
- print("attempt successful")
- turtle.dropDown()
- sleep(TimeToSleep)
- turtle.suckDown()
- end
- end
- end
- turtle.select(1)
- end
- function GetAllItemCount()
- local count = 0
- for i = 1, 16, 1 do
- count = count + turtle.getItemCount(i)
- end
- return count
- end
- function Wash()
- MoveToWash()
- local temp = FindLastFreeSlot()
- for z = 1, temp, 1 do
- turtle.select(z)
- turtle.drop()
- sleep(35)
- end
- turtle.select(1)
- for i = 1, 16, 1 do
- turtle.suck()
- end
- turtle.select(1)
- end
- function PressAndPickUp()
- MoveToPress()
- local temp = FindLastFreeSlot()
- local WaitTime = GetAllItemCount()/16 * 1.6 + 7
- for i = 1, temp, 1 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- MoveToPickUp()
- sleep(WaitTime)
- turtle.suck()
- turtle.suck()
- end
- while true do
- os.pullEvent("redstone")
- MoveToReturn()
- turtle.select(1)
- SuckUpItemsFromChest()
- GrindItems(FindLastFreeSlot())
- if GetAllItemCount()>64 then
- local repeats = TempStorage()
- ReturnAllItems()
- for i = 1, repeats, 1 do
- turtle.select(1)
- turtle.suckUp()
- Wash()
- PressAndPickUp()
- ReturnAllItems()
- end
- else
- Wash()
- PressAndPickUp()
- ReturnAllItems()
- end
- end
Add Comment
Please, Sign In to add comment