Advertisement
Malibucola

uploadstats.lua

Aug 12th, 2022
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local pretty = require("cc.pretty")
  2.  
  3. local brineTank = peripheral.wrap("bottom")
  4.  
  5. -- pretty.pretty_print(brineTank)
  6.  
  7. local owner = "Malibucolamc"
  8. local is_formed = brineTank.isFormed() -- Returns true
  9. local liquid_stored = brineTank.getStored().amount
  10. local liquid_name = brineTank.getStored().name
  11. local tank_length = brineTank.getLength()
  12. local tank_width = brineTank.getWidth()
  13. local tank_height = brineTank.getHeight()
  14. local tank_capacity = brineTank.getTankCapacity()
  15. local tank_percentage_filled = brineTank.getFilledPercentage() -- 1 == 100%, 0.05 -- 5%
  16. local tank_comparator_level = brineTank.getComparatorLevel()
  17.  
  18. while true do
  19.     local request, err = http.post("https://domain.nl/api.php",
  20.         "?action=tankstats" .. "&owner=" .. owner .. "&is_formed=" .. tostring(is_formed) .. "&liquid_stored=" ..
  21.             liquid_stored .. "&liquid_name=" .. liquid_name .. "&tank_length=" .. tank_length .. "&tank_width=" ..
  22.             tank_width .. "&tank_height=" .. tank_height .. "&tank_capacity=" .. tank_capacity ..
  23.             "&tank_percentage_filled=" .. tank_percentage_filled .. "&tank_comparator_level=" .. tank_comparator_level)
  24.     if not request then
  25.         error(err)
  26.     end
  27.     request.readAll()
  28.    
  29.     -- sleep(86400)
  30. end
  31. request.close() -- Don't forget to close!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement