gridcaster

seasons.lua

Jun 10th, 2021 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function mysplit (inputstr, sep)
  2. if sep == nil then
  3. sep = "%s"
  4. end
  5. local t={}
  6. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  7. table.insert(t, str)
  8. end
  9. return t
  10. end
  11. term.redirect(peripheral.wrap("top"))
  12.  
  13. while true do -- # Main Loop
  14.  
  15. term.clear()
  16. term.setCursorPos(1,1)
  17.  
  18. local success, output = commands.exec("seasons get")
  19. if success then
  20. stringTable = mysplit(output)
  21. season=stringTable[3]
  22. day=stringTable[5]
  23. shell.run("time")
  24. print("Current Season :" .. season)
  25. print("Current Day :" .. day)
  26. end
  27. sleep(0.75)
  28. end -- #End Main Loop
  29.  
  30. term.restore()
Add Comment
Please, Sign In to add comment