This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
fishermedders's profile picture

Bar API v1.0

Started by fishermedders, 21 May 2015 - 01:06 AM
fishermedders #1
Posted 21 May 2015 - 03:06 AM
Oi! Have you ever wanted to draw a bar on a screen in computercraft? Probably Not!
Here, I have for you the most useless api Ever made! The Bar Api!

This api exposes two simple functions.

drawBar(x,y,time,color,color1)
x - X position on the screen
y - Y position on the screen
time - time it takes to load said bar to 100%
color - Background Color of the Bar
color1 - Front Color of the Bar
This function draws a bar on a timer.

and,

drawBarPercent(x,y,percent)
x - X position on the screen
y - Y position on the screen
percent - percent already done of the bar.

The Story behind this goes, I was sitting in class (Computer Class lol) and I felt like doing CC, so I went to the Mimic CC emulator, and I wrote this.

So, I figured I would post this even though It isn't the most useful api, but I figure someone can use it ;)/>

Pastebin: http://pastebin.com/eEAgUZuQ or simply pastebin get eEAgUZuQ bar

Example code:

t = term
t.clear()
t.setCursorPos(1,1)
pos = {t.getCursorPos()}
t.write("Cursor Pos X: ")
i = read()
t.write("Cursor Pos Y: ")
i1 = read()
t.write("Percent: ")
i2 = read()
--term.setBackgroundColor(colors.green)
bar.drawBarPercent(i,i1,i2)
t.setCursorPos(2,3)

BTW, sorry for my messy code and posts :lol:/>
Have a nice Day, XMedders
valithor #2
Posted 21 May 2015 - 03:11 AM
Looks nice. :P/>

Might use this sometime.
Edited on 21 May 2015 - 01:17 AM
fishermedders #3
Posted 21 May 2015 - 03:19 AM
Looks nice. :P/>

Might use this sometime.
Val you helped me with this on Lurs server lmfao :P/>
valithor #4
Posted 21 May 2015 - 03:21 AM
Looks nice. :P/>

Might use this sometime.
Val you helped me with this on Lurs server lmfao :P/>

Twas a joke :P/> (self promotion)
Edited on 21 May 2015 - 01:21 AM