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

Nebulae - The Progess Bar Api V1.2.1

Started by GamerNebulae, 08 August 2013 - 10:24 AM
GamerNebulae #1
Posted 08 August 2013 - 12:24 PM
[WIP]NEBULEA - THE PROGRESS BAR API

v1.2.1


The Nebulae API. This API features an easy way of setting up a progress bar by using a Nuclear Information Reader and Sensor Kits. This API will later be forged into my allround monitor API, but for now, here is the Nebulae API!

How to use:

You start by setting up a Nuclear Information Reader (Advanced would be the most wise) next to the computer. You can use a Liquid Sensor Kit to get information from a BuildCraft tank, Coke Oven, a Valve of a Railcraft Tank, etc. With Energy Sensor Kits you can click on a MFSU, BatBox, etc. Anything that holds energy. You put the Sensor Kit in a slot of the Nuclear Information Reader.

NOTE: The program can't handle multiple Nuclear Information Readers. Just because of the way I made it to auto-detect peripherals!

How to setup:

Here's the code on pastebin: http://pastebin.com/j2aGuCGD

After you read the instructions above, you can start to use the API. First of all, download the API by typing this into your computer:

pastebin get j2aGuCGD Nebulae

After that you need to setup your file to acces the API. You can name it whatever you want. This is a test example how it should be used:

os.loadAPI("Nebulae")
while true do
  Nebulae.dataTable("Fuel", 1, "Fuel", true)
  sleep(1)
end
The variables after dataTable are for: (The name of the table, the side of the peripheral, the slot in the peripheral, the heading of the progress bar and the boolean value for liquids or energy (true is for liquids and false is for energy)). You need to put this in a while-loop, otherwise it wouldn't go through the table correctly and it wouldn't update. A sleep time of 1 second is the safest recommended setting.

Changelog:

v1.0:

Public release of the API

v1.1:

[BUG FIX]: Gave the bars and headings an exact formula

Shortened the code a bit by changing string.len with #

Percentages on screen

Automatic detection of the monitor (Special thanks to Bubba!)

Ability for Energy Sensor Kits (not really finished yet)

Gave the option to save an interval for updating (if there is no value given, it will set it to 10 seconds)

Changed the way how you insert information to make it more universal,

v1.2:

Fixed the graphical issue (That took me over a few hours…).

v1.2.1:

Changed some variables for later features.

Threw away the update function. The program wouldn't go through the table correctly. Look at the tutorial above to see how you need to do it.


FEATURES FOR THE NEXT UPDATE:

Option for displaying exact numbers instead of percentages


Known bugs:

None.


To-Do List:

Add functionality for different kinds of Sensor Kits (For example: Energy Sensor Kits)

Giving information about the tank, energy storage device, etc.

Letting the bar change in color as it progresses

More colors and sparkles (inside joke)


If there are any bugs, let me know. I am open for suggestions as well as criticism.
MudkipTheEpic #2
Posted 08 August 2013 - 11:59 PM
no pics no clicks

No… Don't stoop down to that level. That is also the most untrue thing, ever. This page has more then no clicks.

Edit: Also…


Pictures are coming the begin of next week. At the moment I have a terribly slow connection.
GamerNebulae #3
Posted 09 August 2013 - 09:57 AM
no pics no clicks

No… Don't stoop down to that level. That is also the most untrue thing, ever. This page has more then no clicks.

Edit: Also…


Pictures are coming the begin of next week. At the moment I have a terribly slow connection.

Not sure if defending me or bashing me. Anywho, going to try to add some pictures today.
MudkipTheEpic #4
Posted 09 August 2013 - 10:13 AM
no pics no clicks

No… Don't stoop down to that level. That is also the most untrue thing, ever. This page has more then no clicks.

Edit: Also…


Pictures are coming the begin of next week. At the moment I have a terribly slow connection.

Not sure if defending me or bashing me. Anywho, going to try to add some pictures today.

Defending.

Also, maybe you could have it auto-detect a monitor by iterating through peripheral.getNames()?
GamerNebulae #5
Posted 09 August 2013 - 10:22 AM
Defending.

Also, maybe you could have it auto-detect a monitor by iterating through peripheral.getNames()?

Funny you say that. I was thinking about the exact same thing and working on it now. Version 1.1 will be released this weekend with that feature and the formula for the heading and progress bar.
GamerNebulae #6
Posted 10 August 2013 - 11:50 AM
Momentarily working on the grafical bug and working on a different display type!
dn_nb #7
Posted 16 August 2013 - 05:30 AM
This looks nice. Do you have any plans on supporting non-standard blocks via OpenPeriphals (getStored() for energy, etc)? I've been using KillaVanilla's Graphics library for my OpenPeriphals needs, but an actual progress bar API would make things a lot simpler.
GamerNebulae #8
Posted 17 August 2013 - 06:22 AM
This looks nice. Do you have any plans on supporting non-standard blocks via OpenPeriphals (getStored() for energy, etc)? I've been using KillaVanilla's Graphics library for my OpenPeriphals needs, but an actual progress bar API would make things a lot simpler.

I didn't have any plans for support for OpenPeripherals. I can consider it, but not sure though. First I'll finish the planned features. I like your idea though.
apoc123 #9
Posted 25 January 2014 - 01:11 PM
1.6.4 miscperipherals is broken any plan to move on to openperipheral or openccsensors