DorianH935

Untitled

Jun 25th, 2024 (edited)
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. -- Find all peripherals connected to the network
  2. local peripherals = peripheral.getNames()
  3. local ae2
  4.  
  5. -- Loop through peripherals to find the ME interface
  6. for _, name in ipairs(peripherals) do
  7. if peripheral.getType(name) == "meInterface" then
  8. ae2 = peripheral.wrap(name)
  9. break
  10. end
  11. end
  12.  
  13. if not ae2 then
  14. print("No AE2 ME Interface found on the network.")
  15. return
  16. end
  17.  
  18. -- Get all items in the AE2 network
  19. local items = ae2.callRemote("getAvailableItems", {{"item"}})
  20.  
  21. -- Check if there are any items
  22. if #items == 0 then
  23. print("No items found in the AE2 network.")
  24. return
  25. end
  26.  
  27. -- Print the items
  28. print("Items in AE2 network:")
  29.  
  30. for _, item in ipairs(items) do
  31. local itemName = item.name or item.id or "Unknown Item"
  32. print(string.format("%s x %d", itemName, item.count))
  33. end
  34.  
Advertisement
Add Comment
Please, Sign In to add comment