Advertisement
Guest User

moon

a guest
Jan 26th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. --Quaero's Astrological Prognosticator v1.1
  2. --Modified by Wolfsteak
  3. --Type "monitor top moon" to run
  4. --Type "monitor top clear" to tidy
  5.  
  6. local monitor = peripheral.wrap("top")
  7. monitor.setTextScale(0.5)
  8.  
  9. while true do --start looping
  10.  
  11. monitor.setCursorPos(1,1)
  12. print("*  Moon Phase  *")
  13. x,y = term.getSize()
  14. for i = 1,x do term.write('-') end
  15. print('')
  16. print('')
  17. local time = os.time()
  18. local time2 = textutils.formatTime(time,true)
  19. local lunationCycle = {'Full', 'Waning gibbous', 'Third quarter', 'Waning crescent', 'New', 'Waxing crescent', 'First quarter', 'Waxing gibbous'}
  20. local p = ( os.day() - 1) % 8 --deferent
  21. if os.time() < 6 then --epicycle
  22.   p = p - 1 --adjusted calculation date
  23.   p = p%8 --cyclical position
  24.   end
  25. print('Time : ' .. time2)
  26. print('Number : ' .. p)
  27. print('Moon   : ' .. lunationCycle[p+1]) --moon phase
  28. print('')
  29. print('Hold Ctrl+T to exit')
  30. sleep(1)
  31. end --end of loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement