itssnowing

Untitled

Jul 22nd, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. --Setup and variables
  2. owner = "Bipedsnowman"
  3. redProxy = peripheral.find("redstoneIntegrator")
  4. rainside="left"
  5. clearside="right"
  6. thunderside="back"
  7. sleeptime = 0.2
  8.  
  9.  
  10.  
  11. --Functions
  12. function repeatMe()
  13. while true do
  14. event, username, message = os.pullEvent("chat")
  15. print(username .. " just wrote " .. message)
  16. if username == owner and message == "rain" then
  17. callWeather(message)
  18. end
  19. end
  20. end
  21. function callWeather(weather)
  22. if weather == "rain" then
  23. triggerSide(rainside)
  24. elseif weather == "clear" then
  25. triggerSide(clearside)
  26. elseif weather == "thunder" then
  27. triggerside(thunderside)
  28. end
  29. end
  30.  
  31. function triggerSide(side)
  32. redProxy.setOutput(side, true)
  33. sleep(sleeptime)
  34. redProxy.setOutput(side, false)
  35. end
  36.  
  37. --Program body
  38. if redProxy then
  39. print ("redstone proxy connected")
  40. end
  41. --repeatMe()
  42. callWeather("clear")
Advertisement
Add Comment
Please, Sign In to add comment