Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Vars
- local args = {...}
- local startTime
- local lastTime
- -- Functions
- function GoForward()
- while(turtle.forward() == true) do
- end
- end
- function GoBack()
- while(turtle.back() == true) do
- end
- end
- function DoWork()
- redstone.setOutput("bottom", true)
- sleep(0.1)
- redstone.setOutput("bottom", false)
- while(turtle.forward() == true) do
- redstone.setOutput("bottom", true)
- sleep(0.1)
- redstone.setOutput("bottom", false)
- end
- GoBack()
- end
- -- Code
- if(args[1] == nil) then
- print("Error: Smeltery <time (s)>")
- print("Note: 14 seconds = 1 go")
- return
- end
- GoForward()
- turtle.turnLeft()
- turtle.turnLeft()
- startTime = os.clock()
- while(true) do
- lastTime = os.clock()
- if(lastTime - startTime + 14 > tonumber(args[1])) then
- print("Job done after ".. lastTime - startTime .." seconds.")
- return
- end
- DoWork()
- while(true) do
- sleep(1)
- if(os.clock() - lastTime >= 14) then
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement