Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sleepAdv(time)
- matched=false
- while time>0 do
- if ((time-60)>45) then
- sl = 60
- matched=true
- elseif ((time-45)>29 and matched==false) then
- sl = 45
- matched=true
- elseif ((time-30)>14 and matched==false) then
- sl = 30
- matched=true
- elseif ((time-15)>9 and matched==false) then
- sl = 15
- matched=true
- elseif ((time-10)>4 and matched==false) then
- sl = 10
- matched=true
- elseif ((time-5)>1 and matched==false) then
- sl = 5
- matched=true
- else
- sl = 1
- end
- print("Sleeping: ".. time)
- time = time-sl
- sleep(sl)
- matched=false
- end
- end
- function itemFlowCheck()
- sleepfor = 1
- wait = true
- tellertrue = 0
- while wait==true do
- check = redstone.getInput("back")
- if (check==false) then
- print("Sleeping for next check")
- sleepAdv(sleepfor)
- tellertrue=0
- if (sleepfor<60) then
- sleepfor = sleepfor+1
- end
- elseif (check==true) then
- print("Inventory Empty.")
- print("Number of empty checks to go: ".. 15-tellertrue)
- print("Sleeping before check if inventory is still empty.")
- tellertrue = tellertrue+1
- sleepfor = 1
- sleep(2)
- end
- if (tellertrue>15) then
- wait=false
- else
- wait=true
- end
- end
- end
- wr = peripheral.wrap("right")
- freqAchter = 213
- freqQuarry = 206
- itemFlowCheck()
- print("Retrieving Quarry")
- wr.setFreq(freqQuarry)
- wr.set(false)
- while true do
- print("Waiting for run Command")
- if (os.pullEvent("redstone")) then
- if(redstone.getInput("left")) then
- print("Moving Frame")
- wr.setFreq(freqAchter)
- for i=1,9 do
- wr.set(true)
- sleepAdv(1)
- wr.set(false)
- sleepAdv(1)
- end
- print("Place Quarry")
- wr.setFreq(freqQuarry)
- wr.set(true)
- print("Sleeping for 3 minutes for the quarry to start gathering resources")
- sleepAdv(300)
- print("Starting flow check")
- itemFlowCheck()
- print("Retrieving Quarry")
- wr.setFreq(freqQuarry)
- wr.set(false)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment