Advertisement
NekoTiki

Untitled

Dec 4th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local modem = peripheral.wrap("top")
  2. local mon = peripheral.wrap("bottom")
  3.  
  4. modem.open(2)
  5.  
  6. function numberToText(number)
  7.     local num = tonumber(number)
  8.     if num >= 1000000000 then return (math.floor(num/1000000000) .. " T") end
  9.     if num >= 1000000 then return (math.floor(num/1000000) .. " M") end
  10.     if num >= 1000 then return (math.floor(num/1000) .. " k") end
  11. end
  12.  
  13. while true do
  14.     modem.transmit(1,2,"getEnergy")
  15.     local event, mS, sC, rC,
  16.           data, sD = os.pullEvent("modem_message")
  17.    
  18.     print(data["en"] .. " - " .. data["enPT"])
  19.     mon.clear()
  20.     mon.setTextScale(3)
  21.     mon.setCursorPos(1,1)
  22.     mon.write(numberToText(data["en"]))
  23.    
  24.     sleep(1)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement