Advertisement
Ubidibity

enegizer-activate.lua

May 23rd, 2025
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | Gaming | 0 0
  1. -- Connect to the Energizer peripheral
  2. local energizer = peripheral.wrap("back")
  3. if not energizer then
  4.     error("Energizer not found on back side!")
  5. end
  6.  
  7. -- Connect to the monitor
  8. local monitor = peripheral.wrap("top")
  9. if not monitor then
  10.     error("Monitor not found on top side!")
  11. end
  12.  
  13. -- Store the current terminal device (the Advanced Computer's screen)
  14. local console = term.current()
  15.  
  16. -- Redirect output to the monitor
  17. term.redirect(monitor)
  18. monitor.clear()
  19. monitor.setTextScale(0.5)
  20. monitor.setCursorPos(1, 1)
  21. monitor.setTextColor(colors.white)
  22. monitor.setBackgroundColor(colors.black)
  23.  
  24. -- Check and set active state
  25. monitor.write("Current Active: " .. tostring(energizer.getActive()))
  26. monitor.setCursorPos(1, 2)
  27. energizer.setActive(true)
  28. monitor.write("Set to active!")
  29. monitor.setCursorPos(1, 3)
  30. monitor.write("New Active: " .. tostring(energizer.getActive()))
  31.  
  32. -- Restore terminal by redirecting back to the console
  33. term.redirect(console)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement