Posted 12 April 2017 - 08:18 AM
I'm trying to learn Lua and I feel this is so simple and I'm over complicating it.
This is attempting to use a dropper to drop X amount of items every Y amount of seconds while printing its status in the terminal.
The top is the rudimentary example code that IS working… The code in the –[[ ]]– is NOT working but I would much prefer it did.
I would like the X and Y to be configurable at the top so that I can easily edit the code for my different setups.
Maybe printing countdown timer in seconds for the standby time would be easier than the % complete.
This is attempting to use a dropper to drop X amount of items every Y amount of seconds while printing its status in the terminal.
The top is the rudimentary example code that IS working… The code in the –[[ ]]– is NOT working but I would much prefer it did.
I would like the X and Y to be configurable at the top so that I can easily edit the code for my different setups.
while true do
rs.setOutput("back", true) -- dropNum #1
sleep(1)
rs.setOutput("back", false)
sleep(0.5)
rs.setOutput("back", true) -- dropNum #2
sleep(1)
rs.setOutput("back", false)
sleep(360) -- standbyTime
end
--[[
--CONFIG--
local standbyTime = 5 -- Time to standby until next drop cycle. (in seconds)
local dropNum = 2 -- How many items the dropper will drop after standby.
----------
local i
while true do
-- Eject
term.clear()
setCursorPos(1,1)
print("Ejecting: ", dropNum, "!")
i=0
while i=>dropNum do
rs.setOutput("back", true)
sleep(1)
rs.setOutput("back", false)
sleep(0.5)
i=i+1
end
-- Standby
i=0
for i =>standbyTime do
term.clear()
setCursorPos(1,1)
print("Standby: ", standbyTime/100,"%")
sleep(1)
i=i+1
end
rs.setOutput("back", false)
sleep(stanbyTime)
end
--]]
Maybe printing countdown timer in seconds for the standby time would be easier than the % complete.
Edited on 12 April 2017 - 05:50 PM