Advertisement
BruceWplays

CCSereneSeasons

Sep 16th, 2022
926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local seasondone = 0
  2. month = {
  3.     {mname = "January", mlanth = 31},
  4.     {mname = "February", mlanth = 28},
  5.     {mname = "March", mlanth = 31},
  6.     {mname = "April", mlanth = 30},
  7.     {mname = "May", mlanth = 31},
  8.     {mname = "June", mlanth = 30},
  9.     {mname = "July", mlanth = 31},
  10.     {mname = "August", mlanth = 31},
  11.     {mname = "September", mlanth = 30},
  12.     {mname = "October", mlanth = 31},
  13.     {mname = "November", mlanth = 30},
  14.     {mname = "December", mlanth = 31}
  15. }
  16. curmlanth = 0
  17. while true do
  18.     lockmo = 0
  19.     --local monitor = peripheral.wrap("top")
  20.     --monitor.setTextScale(1)
  21.     local maxW, maxH = term.getSize()
  22.     local nyear = 0
  23.     term.clear()
  24.     term.setCursorPos(1,1)
  25.     local nTime = os.time()
  26.     local time_nospace_zero = string.gsub(textutils.formatTime(os.time(), false), " ", " ")  
  27.     local time_nospace_10error = string.gsub(time_nospace_zero, "0:", "12:")
  28.     nTime = string.gsub(time_nospace_10error, "112:", "10:")
  29.     local nDay = os.day()
  30.     local ognday = nDay
  31.     while nDay > 365 do
  32.         nDay = nDay - 365
  33.         nyear = nyear + 1
  34.     end
  35.     lockmday = 0
  36.     local mDay = nDay
  37.     local prevmDay = 0
  38.     curmlanth = 0
  39.     for i=1,#month do
  40.         cordaycnt = 0
  41.         prevmlanth = curmlanth
  42.         curmlanth = curmlanth + month[i].mlanth
  43.         if nDay < curmlanth then
  44.             cordaycnt = cordaycnt + 1
  45.             if nDay > prevmlanth then
  46.                 cordaycnt = cordaycnt + 1
  47.                 lockmday = 1
  48.                 --mDay = mDay + month[i].mlanth
  49.                 prevmDay = mDay
  50.                 curmonth = i
  51.                 break
  52.             end
  53.         end
  54.         if cordaycnt < 5 then
  55.             if lockmday == 0 then
  56.                 mDay = mDay - month[i].mlanth
  57.                 prevmDay = mDay
  58.             end
  59.         end
  60.         --if mDay < 1 then
  61.         --    mDay = mDay + month[i].mlanth
  62.         --    prevmDay = mDay
  63.         --end
  64.         --if mDay > month[i].mlanth then
  65.         --    mDay = mDay - month[i].mlanth
  66.         --    prevmDay = mDay
  67.         --end
  68.         --if mDay < prevmDay then
  69.         --    curmonth = curmonth + 1
  70.         --end
  71.         lockmday = 0
  72.     end
  73.  
  74.     --if mDay > month[curmonth].mlanth then
  75.     --    mDay = mDay - month[curmonth].mlanth
  76.     --    prevmDay = mDay
  77.     --end
  78.     term.setCursorPos(1, maxH)
  79.     if ognday < 10000 then
  80.         print("(" .. "Total Days: "..ognday.. ")")
  81.     elseif ognday > 9999 then
  82.         print("(" .. "TotalDays: "..ognday.. ")")
  83.     elseif ognday > 99999 then
  84.         print("(" .. "TotalDays:"..ognday.. ")")
  85.     elseif ognday > 999999 then
  86.         print("(" .. "TtlDs:"..ognday.. ")")
  87.     end
  88.     term.scroll(-1)
  89.     term.setCursorPos(1,1)
  90.     print(nTime)
  91.     term.setCursorPos(1,2)
  92.     print(mDay.." "..month[curmonth].mname)
  93.     term.setCursorPos(1,3)
  94.     print("Year " .. nyear)
  95.     local ndaylc = string.len("Day " .. nDay)
  96.     ndaylc = ndaylc - 1
  97.     term.setCursorPos(maxW - ndaylc,3)
  98.     print("Day " .. nDay)
  99.  
  100.     if month[curmonth].mname == "june" then
  101.         if mDay == 1 then
  102.             commands.exec("sereneseasons setseason early_summer")
  103.             seasondone = 1
  104.         end
  105.     end
  106.  
  107.     local mineminute = 60 / 72
  108.     local mineminute2 = mineminute * 10
  109.     sleep(mineminute2)
  110.     if seasondone == 1 then
  111.         sleep(1260)
  112.         seasondone = 0
  113.     end
  114.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement