Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize peripherals
- local meBridge = peripheral.wrap("left") -- Adjust based on your setup, e.g., 'left', 'right', etc.
- local monitor = peripheral.wrap("right") -- Adjust to your setup
- -- Set the monitor's text scale (optional)
- monitor.setTextScale(0.5)
- -- Function to print to the monitor
- local function printToMonitor(text, line)
- monitor.setCursorPos(1, line)
- monitor.clearLine()
- monitor.write(text)
- end
- -- Function to list and display items in the AE2 network
- local function displayItems()
- monitor.clear()
- -- Fetch items from the AE2 network
- local items = meBridge.listItems()
- if not items then
- printToMonitor("No items in the network", 1)
- return
- end
- -- Display items (limit to 4 lines to fit the 4x5 monitor)
- local line = 1
- for _, item in pairs(items) do
- local displayText = string.format("%s: %d", item.name:match(":(%w+)$") or item.name, item.count)
- printToMonitor(displayText, line)
- line = line + 1
- if line > 4 then break end -- Fit the 4x5 display
- end
- end
- -- Main loop to refresh and display the items
- while true do
- displayItems()
- sleep(5) -- Refresh every 5 seconds
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement