--/lua
load = function()
timef = fs.open("time", "r")
timeone = tonumber(timef.readLine(1))
timetwo = tonumber(timef.readLine(2))
timethree = tonumber(timef.readLine(3))
timefour = tonumber(timef.readLine(4))
timefive = tonumber(timef.readLine(5))
timesix = tonumber(timef.readLine(6))
timeseven = tonumber(timef.readLine(7))
timeeight = tonumber(timef.readLine(8))
timenine = tonumber(timef.readLine(9))
timeten = tonumber(timef.readLine(10))
timeelven = tonumber(timef.readLine(11))
timetwlve = tonumber(timef.readLine(12))
timetherteen = tonumber(timef.readLine(14))
timefourteen = tonumber(timef.readLine(15))
timef.close()
timel = fs.open("time left", "r")
timeleftOne = tonumber(timel.readLine(1))
timeleftTwo = tonumber(timel.readLine(2))
timeleftThree = tonumber(timel.readLine(3))
timeleftFour = tonumber(timel.readLine(4))
timeleftFive = tonumber(timel.readLine(5))
timeleftSix = tonumber(timel.readLine(6))
timeleftSeven = tonumber(timel.readLine(7))
timeleftEight = tonumber(timel.readLine(8))
timeleftNine = tonumber(timel.readLine(9))
timeleftTen = tonumber(timel.readLine(10))
timeleftElven = tonumber(timel.readLine(11))
timeleftTwlve = tonumber(timel.readLine(12))
timeleftTherteen = tonumber(timel.readLine(13))
timeleftFourteen = tonumber(timel.readLine(14))
timel.close()
timerf = fs.open("timer", "r")
tme = tonumber(timerf.readLine(1))
qu = tonumber(timerf.readLine(2))
timerf.close()
if timeone == nil then timeone = 0 end
if timetwo == nil then timetwo = 0 end
if timethree == nil then timethree = 0 end
if timefour == nil then timefour = 0 end
if timefive == nil then timefive = 0 end
if timesix == nil then timesix = 0 end
if timeseven == nil then timeseven = 0 end
if timeeight == nil then timeeight = 0 end
if timenine == nil then timenine = 0 end
if timeten == nil then timeten = 0 end
if timeelven == nil then timeelven = 0 end
if timetwlve == nil then timetwlve = 0 end
if timetherteen == nil then timetherteen = 0 end
if timefourteen == nil then timefourteen = 0 end
if qu == nil then qu = 0 end
if tme == nil then tme = 0 end
if timeleftOne == nil then timeleftOne = 0 end
if timeleftTwo == nil then timeleftTwo = 0 end
if timeleftThree == nil then timeleftThree = 0 end
if timeleftFour == nil then timeleftFour = 0 end
if timeleftFive == nil then timeleftFive = 0 end
if timeleftSix == nil then timeleftSix = 0 end
if timeleftSeven == nil then timeleftSeven = 0 end
if timeleftEight == nil then timeleftEight = 0 end
if timeleftNine == nil then timeleftNine = 0 end
if timeleftTen == nil then timeleftTen = 0 end
if timeleftElven == nil then timeleftElven = 0 end
if timeleftTwlve == nil then timeleftTwlve = 0 end
if timeleftTherteen == nil then timeleftTherteen = 0 end
if timeleftFourteen == nil then timeleftFourteen = 0 end
term.clear()
term.setCursorPos(1,1)
end
load()
addcol = function(col, side)
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side),col))
end
remcol = function(col, side)
rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side),col))
end
save = function()
print("save started")
while true do
sleep(0)
timerf = fs.open("timer", "w")
timerf.writeLine(tostring(tme))
timerf.write(tostring(qu))
timerf.close()
timef = fs.open("time", "w")
timef.writeLine(tostring(timeone))
timef.writeLine(tostring(timetwo))
timef.writeLine(tostring(timethree))
timef.writeLine(tostring(timefour))
timef.writeLine(tostring(timefive))
timef.writeLine(tostring(timesix))
timef.writeLine(tostring(timeseven))
timef.writeLine(tostring(timeeight))
timef.writeLine(tostring(timenine))
timef.writeLine(tostring(timeten))
timef.writeLine(tostring(timeelven))
timef.writeLine(tostring(timetwlve))
timef.writeLine(tostring(timetherteen))
timef.write(tostring(timefourteen))
timef.close()
timel = fs.open("time left", "w")
timel.writeLine(tostring(timeleftOne))
timel.writeLine(tostring(timeleftTwo))
timel.writeLine(tostring(timeleftThree))
timel.writeLine(tostring(timeleftFour))
timel.writeLine(tostring(timeleftFive))
timel.writeLine(tostring(timeleftSix))
timel.writeLine(tostring(timeleftSeven))
timel.writeLine(tostring(timeleftEight))
timel.writeLine(tostring(timeleftNine))
timel.writeLine(tostring(timeleftTen))
timel.writeLine(tostring(timeleftElven))
timel.writeLine(tostring(timeleftTwlve))
timel.writeLine(tostring(timeleftTherteen))
timel.write(tostring(timeleftFourteen))
timel.close()
sleep(0.1)
end
end
timer = function()
print("timer started")
while true do
sleep(0)
while qu < 59 do
sleep(1)
qu = qu + 1
end
qu = 0
tme = tme + 1
end
end
type1 = function(camefrom)
rs.setOutput("right", true)
rs.setOutput("left", true)
term.clear()
term.setCursorPos(1,1)
print("you just put something in number "..camefrom.."...")
print("|-------------------------------------------|")
print("| |")
print("| what would you like to make? |")
print("| a) Brew--------------------------0 minuts |")
print("| B)/> Youngster-------------------120 minuts |")
print("| c) Beer------------------------240 minuts |")
print("| d) Ale-------------------------720 minuts |")
print("| e) Dragonblood----------------1440 minuts |")
print("| f) rum--------------------------60 minuts |")
print("| |")
print("|-------------------------------------------|")
local toreturn = read()
if toreturn == "a" or toreturn == "A" then
toreturn = 0
elseif toreturn == "b" or toreturn == "B" then
toreturn = 120
elseif toreturn == "c" or toreturn == "C" then
toreturn = 240
elseif toreturn == "d" or toreturn == "D" then
toreturn = 720
elseif toreturn == "e" or toreturn == "E" then
toreturn = 1440
elseif toreturn == "f" or toreturn == "F" then
toreturn = 60
else
toreturn = tonumber(toreturn)
end
rs.setOutput("right", false)
rs.setOutput("left", false)
term.clear()
term.setCursorPos(1,1)
return toreturn
end
main = function()
print("main started")
while true do
sleep(0)
if rs.testBundledInput ("back", 1) == true then
timeone = tme
addcol(1, "bottom")
timeleftOne = type1("one")
elseif rs.testBundledInput ("back", 2) == true then
timetwo = tme
addcol(2, "bottom")
timeleftTwo = type1("two")
elseif rs.testBundledInput ("back", 4) == true then
timethree = tme
addcol(4, "bottom")
timeleftThree = type1("three")
elseif rs.testBundledInput ("back", 8) == true then
timefour = tme
addcol(8, "bottom")
timeleftFour = type1("four")
elseif rs.testBundledInput ("back", 16) == true then
timefive = tme
addcol(16, "bottom")
timeleftFive = type1("five")
elseif rs.testBundledInput ("back", 32) == true then
timesix = tme
addcol(32, "bottom")
timeleftSix = type1("six")
elseif rs.testBundledInput ("back", 64) == true then
timeseven = tme
addcol(64, "bottom")
timeleftSeven = type1("seven")
elseif rs.testBundledInput ("back", 128) == true then
timeeight = tme
addcol(128, "bottom")
timeleftEight = type1("eight")
elseif rs.testBundledInput ("back", 256) == true then
timenine = tme
addcol(256, "bottom")
timeleftNine = type1("nine")
elseif rs.testBundledInput ("back", 512) == true then
timeten = tme
addcol(512, "bottom")
timeleftTen = type1("ten")
elseif rs.testBundledInput ("back", 1024) == true then
timeelven = tme
addcol(1024, "bottom")
timeleftElven = type1("elven")
elseif rs.testBundledInput ("back", 2048) == true then
timetwlve = tme
addcol(2048, "bottom")
timeleftTwlve = type1("twlve")
elseif rs.testBundledInput ("back", 4096) == true then
timetherteen = tme
addcol(4096, "bottom")
timeleftTherteen = type1("therteen")
elseif rs.testBundledInput ("back", 8192) == true then
timefourteen = tme
addcol(8192, "bottom")
timeleftFourteen = type1("fourteen")
end
One = tme - timeone
Two = tme - timetwo
Three = tme - timethree
Four = tme - timefour
Five = tme - timefive
Six = tme - timesix
Seven = tme - timeseven
Eight = tme - timeeight
Nine = tme - timenine
Ten = tme - timeten
Elven = tme - timeelven
Twlve = tme - timetwlve
Therteen = tme - timetherteen
Fourteen = tme - timefourteen
term.setCursorPos(1,1)
if One > tonumber(timeleftOne) or One == tonumber(timeleftOne) then
timeone = 0
print("One finshed or empty")
remcol(1, "bottom")
else
print("Still waiting "..tostring(timeleftOne - One).." minuts for one")
addcol(1, "bottom")
end
if Two > tonumber(timeleftTwo) or Two == tonumber(timeleftTwo) then
timetwo = 0
print("Two finshed or empty")
remcol(2, "bottom")
else
print("Still waiting "..tostring(timeleftTwo - Two).." minuts for Two")
addcol(2, "bottom")
end
if Three > tonumber(timeleftThree) or Three == tonumber(timeleftThree) then
timethree = 0
print("Three finshed or empty")
remcol(4, "bottom")
else
print("Still waiting "..tostring(timeleftThree - Three).." minuts for Three")
addcol(4, "bottom")
end
if Four > tonumber(timeleftFour) or Four == tonumber(timeleftFour) then
timefour = 0
print("Four finshed or empty")
remcol(8, "bottom")
else
print("Still waiting "..tostring(timeleftFour - Four).." minuts for Four")
addcol(8, "bottom")
end
if Five > tonumber(timeleftFive) or Five == tonumber(timeleftFive) then
timefive = 0
print("Five finshed or empty")
remcol(16, "bottom")
else
print("Still waiting "..tostring(timeleftFive - Five).." minuts for Five")
addcol(16, "bottom")
end
if Six > tonumber(timeleftSix) or Six == tonumber(timeleftSix) then
timesix = 0
print("Six finshed or empty")
remcol(32, "bottom")
else
print("Still waiting "..tostring(timeleftSix - Six).." minuts for Six")
addcol(32, "bottom")
end
if Seven > tonumber(timeleftSeven) or Seven == tonumber(timeleftSeven) then
timeseven = 0
print("Seven finshed or empty")
remcol(64, "bottom")
else
print("Still waiting "..tostring(timeleftSeven - Seven).." minuts for Seven")
addcol(64, "bottom")
end
if Eight > tonumber(timeleftEight) or Eight == tonumber(timeleftEight) then
timeeight = 0
print("Eight finshed or empty")
remcol(128, "bottom")
else
print("Still waiting "..tostring(timeleftEight - Eight).." minuts for Eight")
addcol(128, "bottom")
end
if Nine > tonumber(timeleftNine) or Nine == tonumber(timeleftNine) then
timenine = 0
print("Nine finshed or empty")
remcol(256, "bottom")
else
print("Still waiting "..tostring(timeleftNine - Nine).." minuts for Nine")
addcol(256, "bottom")
end
if Ten > tonumber(timeleftTen) or Ten == tonumber(timeleftTen) then
timeten = 0
print("Ten finshed or empty")
remcol(512, "bottom")
else
print("Still waiting "..tostring(timeleftTen - Ten).." minuts for Ten")
addcol(512, "bottom")
end
if Elven > tonumber(timeleftElven) or Elven == tonumber(timeleftElven) then
timeelven = 0
print("Elven finshed or empty")
remcol(1024, "bottom")
else
print("Still waiting "..tostring(timeleftElven - Elven).." minuts for Elven")
addcol(1024, "bottom")
end
if Twlve > tonumber(timeleftTwlve) or Twlve == tonumber(timeleftTwlve) then
timetwlve = 0
print("Twlve finshed or empty")
remcol(2048, "bottom")
else
print("Still waiting "..tostring(timeleftTwlve - Twlve).." minuts for Twlve")
addcol(2048, "bottom")
end
if Therteen > tonumber(timeleftTherteen) or Therteen == tonumber(timeleftTherteen) then
timetherteen = 0
print("Therteen finshed or empty")
remcol(4096, "bottom")
else
print("Still waiting "..tostring(timeleftTherteen - Therteen).." minuts for Therteen")
addcol(4096, "bottom")
end
if Fourteen > tonumber(timeleftFourteen) or Fourteen == tonumber(timeleftFourteen) then
timefourteen = 0
print("Fourteen finshed or empty")
remcol(8192, "bottom")
else
print("Still waiting "..tostring(timeleftFourteen - Fourteen).." minuts for Fourteen")
addcol(8192, "bottom")
end
sleep(0.2)
term.clear()
end
end
parallel.waitForAll (timer, main, save)