bldng1

proto

Jun 11th, 2024
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. if ~monitor do
  2. monitor=term
  3. end
  4.  
  5. function clear()
  6. monitor.clear()
  7. end
  8. function getSize()
  9. return monitor.getSize()
  10. end
  11. function draw_text(x, y, text, text_color, bg_color)
  12. monitor.setBackgroundColor(bg_color)
  13. monitor.setTextColor(text_color)
  14. monitor.setCursorPos(x,y)
  15. monitor.write(text)
  16. end
  17. function draw_line(x, y, length, color)
  18. draw_text(x,y,string.rep(" ", length),color,color)
  19. end
  20. function progress_bar(x, y, length, minVal, maxVal, bar_color, bg_color)
  21. draw_line(x, y, length, bg_color) --backgoround bar
  22. local barSize = math.floor((minVal/maxVal) * length)
  23. draw_line(x, y, barSize, bar_color) --progress so far
  24. end
  25.  
  26. -- APPLICATION CODE
  27. statsmeta={}
  28. stats={}
  29. modes={}
  30.  
  31.  
  32.  
  33.  
  34. statsmeta.fuelstorage="percent"
  35. statsmeta.test="number"
  36. statsmeta.other="boolean"
  37. modes.OFF=function(stats)
  38. print("test")
  39. end
  40. modes.ON=function(stats)
  41. print("test")
  42. end
  43.  
  44. function updateStats()
  45. stats.fuelstorage=89
  46. stats.test=84
  47. stats.other=true
  48. end
  49.  
  50.  
  51.  
  52.  
  53. while true do
  54.  
  55.  
  56. end
  57.  
Advertisement
Add Comment
Please, Sign In to add comment