Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Grok's third attempt to get my enegizer cube working in Minecraft ATM10
- -- second revision too much information for the turtle console, I'm adding a 3x4 (WxH) monitor on top of an advanced computer and outputting there
- -- third revision correcting up with top and some other additional activation attempts, also fixed the term.restore error (or at
- -- least trapped it)
- -- Connect to the Energizer peripheral (on the "back" side)
- local energizer = peripheral.wrap("back")
- -- Connect to the Advanced Monitor peripheral (on the "top" side)
- local monitor = peripheral.wrap("top")
- -- Check if peripherals are connected
- if not energizer then
- error("Energizer not found on back side!")
- end
- if not monitor then
- error("Monitor not found on top side!")
- end
- -- Store the current terminal device (the Advanced Computer's screen)
- local console = term.current()
- -- Set the monitor as the output terminal
- term.redirect(monitor)
- -- Clear the monitor and set text properties
- monitor.clear()
- monitor.setTextScale(0.5) -- Default scale for readability (1 pixel = 1 character)
- monitor.setCursorPos(1, 1)
- monitor.setTextColor(colors.white)
- monitor.setBackgroundColor(colors.black)
- -- Print the Energizer status to the monitor
- monitor.write("Energizer Status")
- monitor.setCursorPos(1, 2)
- monitor.write("--------------")
- monitor.setCursorPos(1, 3)
- monitor.write("Assembled: " .. tostring(energizer.mbIsAssembled()))
- monitor.setCursorPos(1, 4)
- monitor.write("Active: " .. tostring(energizer.getActive()))
- monitor.setCursorPos(1, 5)
- monitor.write("Paused: " .. tostring(energizer.mbIsPaused()))
- monitor.setCursorPos(1, 6)
- monitor.write("Energy: " .. energizer.getEnergyStoredAsText())
- monitor.setCursorPos(1, 7)
- monitor.write("Capacity: " .. energizer.getEnergyCapacityAsText())
- monitor.setCursorPos(1, 8)
- monitor.write("In Last: " .. energizer.getEnergyInsertedLastTickAsText())
- monitor.setCursorPos(1, 9)
- monitor.write("Out Last: " .. energizer.getEnergyExtractedLastTickAsText())
- monitor.setCursorPos(1, 10)
- monitor.write("Connected: " .. tostring(energizer.mbIsConnected()))
- monitor.setCursorPos(1, 11)
- local minCoord = energizer.mbGetMinimumCoordinate()
- monitor.write("Min: " .. minCoord[1] .. "," .. minCoord[2] .. "," .. minCoord[3])
- monitor.setCursorPos(1, 12)
- local maxCoord = energizer.mbGetMaximumCoordinate()
- monitor.write("Max: " .. maxCoord[1] .. "," .. maxCoord[2] .. "," .. maxCoord[3])
- -- Restore the terminal to the computer screen
- term.redirect(console)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement