SythsGod

progressAPI

Nov 3rd, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local startString = "[-------------------------------------]"
  2. local firstOff = 0
  3. local flatCounter = 35
  4. local fullCounter = 0
  5. local counterJump = 0
  6. local characterCount = 36
  7.  
  8. function statusBar(loop, duration)
  9.     counterJump = characterCount / duration
  10.     fullCounter = counterJump * loop
  11.     flatCounter = characterCount - counterJump * loop - 1
  12.    
  13.     if characterCount % duration ~= 0 then
  14.         firstOff = 1
  15.     end
  16.    
  17.     flatCounter = flatCounter + firstOff
  18.     if loop == duration then
  19.         flatCounter = flatCounter - firstOff
  20.     end
  21.    
  22.     if loop == 0 then
  23.         print("Progress:")
  24.         print(startString)
  25.     else
  26.         setProgressBar()
  27.     end  
  28. end
  29.    
  30. function setProgressBar()
  31.     local text = ""
  32.    
  33.     for i = 0, fullCounter do
  34.         text = text .. "0"
  35.     end
  36.    
  37.     for j = 0, flatCounter do
  38.         text = text .. "-"
  39.     end
  40.    
  41.     fullCounter = fullCounter + counterJump
  42.     flatCounter = flatCounter - counterJump
  43.    
  44.     print("Progress:")
  45.     print("[" .. text .. "]")
  46. end
Add Comment
Please, Sign In to add comment