Advertisement
ccraftersanonmoose

weather-monitor.lua

Mar 25th, 2025
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. -- Script to monitor weather and other environment details in various locations throughout world
  2. -- planning to setup multiple systems to report into this and display throughout bases or public squares
  3. -- something akin to a weather station, may change this setup to be minimal (1 detector, connected to one computer, w/ ender modem, maybe in a doplar like casing for looks)
  4. -- Version History
  5. -- version 0.1 3-24-25
  6. -- starting with monitoring of local environment info and displaying on a monitor
  7. -- at this stage all will be connected via networking cables
  8. -- would like to add other systems to this can can connect via ender or wireless modems
  9.  
  10. ---------------------------------------------
  11.  
  12. local detector = peripheral.wrap("environmentDetector_0")
  13. local mon = peripheral.wrap("advanced_monitor_0")
  14. mon.clear()
  15.  
  16. -- collect local info, this will be important so that each station can send their local info to eachother
  17. local function getLocalInfo()
  18.     local raining = detector.isRaining()
  19. end
  20.  
  21. -- display local info, this may get changed into a separate script to display in bases / towns ( really anywhere you want to )
  22. function displayLocalInfo()
  23.     mon.setTextScale(1)
  24.     mon.setCursorPos(1,2)
  25.     mon.write("Weather Station")
  26.     if detector.isSunny() == true then
  27.       mon.setCursorPos(1,3)
  28.       mon.write("Outside:")
  29.       mon.setCursorPos(1,4)
  30.      -- mon.clearLine()
  31.       mon.write("Sunny     ")
  32.         else if detector.isRaining() == true then
  33.         mon.setCursorPos(1,3)
  34.         mon.write("Outside:")
  35.         mon.setCursorPos(1,4)
  36.       --  mon.clearLine()
  37.         mon.write("Raining    ")
  38.             else if detector.isThunder() == true then
  39.             mon.setCursorPos(1,3)
  40.             mon.write("Outside:")
  41.              mon.setCursorPos(1,4)
  42.             --  mon.clearLine()
  43.             mon.write("Thunder Storm")
  44.             end
  45.         end
  46.     end
  47. end
  48.  
  49. while true do
  50.     getLocalInfo()
  51.     displayLocalInfo()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement