Advertisement
giwdul

applied_energistics_total_stock_CC

Jul 3rd, 2023 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. -- displays in chat the number of items and percentage of applied use. Tweaked CC for chatBox
  2.  
  3. local bridge = peripheral.find("meBridge")
  4. local chatBox = peripheral.find("chatBox")
  5. local chatBot = "§2Jarvis"
  6.  
  7. -- Boucle infinie
  8. while true do
  9.     -- Récupère les valeurs
  10.     local max = bridge.getTotalItemStorage()
  11.     local count = bridge.getUsedItemStorage()
  12.  
  13.     -- Calcul du pourcentage
  14.     local percentage = (count / max) * 100
  15.  
  16.     -- Arrondit le pourcentage à deux chiffres après la virgule
  17.     local roundedPercentage = string.format("%.2f", percentage)
  18.  
  19.     -- Envoie le message
  20.     chatBox.sendMessage("Stockage applied : " .. count .. " / " .. max .. " (" .. roundedPercentage .. "%)", chatBot)
  21.  
  22.     -- Attente de 10 minutes
  23.     os.sleep(600)
  24. end
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement