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

TE energy cell/EnderIO Capacitor bank power monitor program

Started by RickiHN, 16 August 2014 - 05:18 PM
RickiHN #1
Posted 16 August 2014 - 07:18 PM
Wrote this simple plug'n'play script with the purpose of monitoring a TE3 Energy cells or EnderIO Capacitor Banks energy level and use it to output a redstone signal to toggle power production accordingly.




The script will by default detect any Cell or Capacitor adjacent or connected by cabled modems automatically and output a redstone signal out the back of the Computer once energy level falls below 10%. Redstone signal is then cut once energy levels are once again above 90%. (These percentages can easily be altered in the top of the code). For now it is limited to supporting just one Cell/capacitor per computer.

Should you wish to (it is entirely optional), the script will support and automatically detect an Advanced Monitor (1 high, 2 wide) either adjacent or attached by cabled modem. This will display the current state of the redstone signal and the current and maximum energy storage.

Great for preserving fuel in starter setups by controlling engines/dynamos/etc. to only run when needed.

http://pastebin.com/rjfa4ymR
Strange #2
Posted 09 January 2015 - 04:55 PM
Sorry to necro - does this require OpenPeripherals? Doesn't work for me (can't find the storage).

strange
Gomo #3
Posted 25 January 2015 - 06:43 PM
Sorry to necro - does this require OpenPeripherals? Doesn't work for me (can't find the storage).

strange

Yes, it does.

On topic:
I'm still new at Computercraft and I'm amazed how awesome this program is. I love it!
I've been trying to change it a bit so it would display larger amounts of energy (milions of RF) but whenever I change one part, the rest doesn't seem to work. >.>
Could you please modify it a bit so that it accepts larger capacity - more energy cells? I'd really appreciate it!
chanzie #4
Posted 13 February 2015 - 01:24 PM
will this also work for mekanism's energy cubes?
Umaroth #5
Posted 28 March 2015 - 05:24 PM
It looks to me as if this shouldn't work anymore, I ran peripheral.getType() on both a Capacitor Bank and an Energy Cell. The Capacitor Bank returned "capacitor_bank" and the energy cell returned "powered_tile".

The script looks for "tile_enderio_blockcapacitorbank_name" and "cofh_thermalexpansion_energycell". I don't know if peripherals return more than one type in an array, but if they don't then the types the scripts looks for should never be found and the program should always output "No Energy storage found. Halting script!"

Okay, I fixed it. The easiest way to fix it is to find and replace all instances of "tile_enderio_blockcapacitorbank_name" with "capacitor_bank" and all instances of "cofh_thermalexpansion_energycell" with "powered_tile". There are two instances of each. That is all that's required to make the script work.

However, I'm working on a much improved version of the script that adds support for billions of RF, formats the program to work on 2x3 monitors instead of 1x2 ones, fixes the spacing in the script, and much more.

will this also work for mekanism's energy cubes?

No, it won't currently, but I'm revising the script and I'll see about adding support for it. Unless the cubes don't store RF or don't work with OpenPeripheralsIntegration, then it won't be possible.

Update: So I tried it out and Mekanisms Energy Cubes can be read by my script, but there's no way to differentiate them from TE4 Energy Cells, since they have the same peripheral type. This means that the script will connect to and read from Mekanism Energy Cubes, but they don't use RF so I can't officially support them.
Edited on 29 March 2015 - 03:14 AM
Umaroth #6
Posted 29 March 2015 - 05:17 AM
Alright, I finished work on the updated script.

I've uploaded it here: http://pastebin.com/cA2TNNdH

I also uploaded a changelog of all the changes made from this original here: http://pastebin.com/erPf3t4t

The changes made are:

–Updated to work with current peripheral types (as of 1.7.10 and Thermal Expansion 4.0.0RC7 and EnderIO v2.2.8)
–Fixed spacing
–Formatted for 2x3 Monitor instead of 1x2
–Added formatting support for billions of RF
–Separated formatting of Current and Max RF values
–Made placement of RF values dynamic
–Made "of:" placement dynamic, it now places itself over the first digit of the Max value
–Added support for multiple connections to Capacitor Banks and Energy Cells, now accepts as many of each as you can connect to the network
–Added support for multiple monitors, now accepts as many monitors as you can connect to the network
–Added support for both 1x2 and 2x3 monitors with automatic detection and dynamic scaling for each
–Added support for Big Reactors' turbines and reactors. Only supports one of each.
–Added configurable redstone output side.

If you find any bugs or have any update suggestions, please be sure to let me know.
Edited on 30 March 2015 - 02:45 AM
michaelcampbell229 #7
Posted 02 December 2015 - 03:45 AM
Alright, I finished work on the updated script.
I've uploaded it here: http://pastebin.com/cA2TNNdH

Nice script, although I have two questions:
1) any way to disable the engines on/off part (I just want it to display the amount of energy)
2) and make a redstone lamp flash when it gets bellow a certain limit?
AyScorch #8
Posted 22 February 2020 - 09:27 PM
Alright, I finished work on the updated script.
I've uploaded it here: http://pastebin.com/cA2TNNdH
Hey, I'm running TE4 176 and CC 1.7. I keep on getting a not detected error from my advanced computer. I have a Resonant cell behind the computer, and I don't have any of the expansion mods for CC. Is there any way I could get it to work?
Lupus590 #9
Posted 22 February 2020 - 09:56 PM
Hey, I'm running TE4 176 and CC 1.7. I keep on getting a not detected error from my advanced computer. I have a Resonant cell behind the computer, and I don't have any of the expansion mods for CC. Is there any way I could get it to work?

You probably need openperipherals: https://openmods.info/

Also, necro posting is not ok.
Edited on 22 February 2020 - 08:56 PM