Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[BarAPI
- ActiveColor = Full BarColor
- InActiveColor = Empty Bar Color
- n = Percentage that needs to be filled
- CursorX = Bar start X pos
- CursorY = Bar Start Y pos
- TextColor = Color for stripes on bar set to same as ActiveColor if you dont want bars
- Mon = Monitor to display on
- Made By SteamPunk_Devil -- CCfourm Name Makeme -- Ingame Name SteamPunk_Angel
- ]]--
- function Percentage(current,total) --returns One number as a percentage of the second one --TBD Round to a Decimal place
- local No1 = current
- local No2 = total
- local Percent = (No1 / No2) * 100
- return Percent
- end
- function Round(num, idp) --rounds num to idp decimals
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function PercentBar(CursorX, CursorY, InActiveColor, ActiveColor, TextColor, n, Mon) --displays a bar
- local n10 = n/10
- local BarCursX = CursorX
- local BarCursY = CursorY
- local FormdN = Round(n10, 0)
- local i = 0
- local Paste = Mon
- Paste.setCursorPos(CursorX, CursorY)
- Paste.setBackgroundColor(InActiveColor)
- Paste.write(" ")
- Paste.setCursorPos(CursorX, CursorY)
- --for i, FormdN, 1 do
- while i <= FormdN do
- print(i)
- print(FormdN)
- Paste.setCursorPos(BarCursX,BarCursY)
- Paste.setBackgroundColor(ActiveColor)
- Paste.setTextColor(TextColor)
- Paste.write("/")
- BarCursX = BarCursX + 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment