mrx
New Member
Posts: 9 Likes: 0
|
Post by mrx on Jun 3, 2021 21:44:40 GMT
Shows a progress bar, useful for example for showing the status of a skill gain. Let me know if you have any suggestions or problems and I'll try to tackle them. function progressBar(percentageProgress, maxCharacters) local progress = math.floor((percentageProgress / 100) * maxCharacters) local result = "[" for i = 1, progress do result = result .. "=" end local whiteSpace = maxCharacters - progress for i = 1, whiteSpace do result = result .. " " end result = result .. "] " .. percentageProgress .. "%" print(result) end
-- Usage example below:
percentageProgress = 0 maxCharacters = 50 repeat clear() progressBar(percentageProgress, maxCharacters) percentageProgress = percentageProgress + 1 sleep(50) until percentageProgress > 100
|
|