Advertisement
asweigart

fuel.lua

Mar 29th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. -- ComputerCraft script to display fuel stats
  2. -- Written by al@inventwithpython.com
  3. -- Find my other scripts at https://github.com/asweigart/al-computercraft
  4. -- or http://turtlescripts.com/profile/AlSweigart
  5.  
  6. if turtle.getFuelLimit() == 'unlimited' then
  7. print('Unlimited fuel mode is enabled.')
  8. return
  9. end
  10.  
  11. io.write(tostring(turtle.getFuelLevel()))
  12. io.write(' / ')
  13. io.write(tostring(turtle.getFuelLimit()))
  14. io.write(' ')
  15.  
  16. local amt = 100 * turtle.getFuelLevel() / turtle.getFuelLimit()
  17. print(tostring(amt) .. '%')
  18. if amt < 100 then
  19. print('Space left: ' .. tostring(turtle.getFuelLimit() - turtle.getFuelLevel()))
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement