ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: ImTehZink on Jan 29, 2021, 09:19 AM

Title: Energy Cell Power Monitor Program having issues
Post by: ImTehZink on Jan 29, 2021, 09:19 AM
I am trying to read power levels off of an Energy Cell (Resonant) from Thermal Expansion, and it will not recognize the Energy Cell. I have tried multiple different Item IDs, to no avail. I am also using Plethora as a replacement for OpenPeripherals since I cannot find an updated version of OpenPeripherals for 1.12.2.

Any suggestions for what to change in the code, or what other OpenPeriphal mod replacements I should use are welcome.

TE5 Energy Cell Power Monitor Code - pastebin.com/Vcyyup4e
Title: Energy Cell Power Monitor Program having issues
Post by: Lupus590 on Jan 29, 2021, 12:20 PM
When you activate the modem on the energy cell you should get a message in chat that tells you the energy cell's peripheral name. You should be able to click on this message to copy it and then use ctrl+v to paste it into your code. If you are not using a modem then you should be using the side of the computer that the energy cell is attached to as its peripheral name.

There is also peripheral.find which you seem to be reimplementing: https://tweaked.cc/module/peripheral.html#v:find

Title: Energy Cell Power Monitor Program having issues
Post by: ImTehZink on Jan 29, 2021, 05:01 PM
This is what i got when clicking the modem ON on the energy cell, 'thermalexpansion:storage_cell_6' Still will not recognize the energy cell with that Item ID.
Title: Energy Cell Power Monitor Program having issues
Post by: ImTehZink on Jan 29, 2021, 05:21 PM
Quote from: Lupus590 on Jan 29, 2021, 12:20 PMThere is also peripheral.find which you seem to be reimplementing: https://tweaked.cc/module/peripheral.html#v:find


Also, would this be causing the issue? and how could I make the peripheral.find better so that it wouldn't be re-implemented?
Title: Energy Cell Power Monitor Program having issues
Post by: QuickMuffin8782 on Jan 29, 2021, 10:04 PM
Quote from: ImTehZink on Jan 29, 2021, 05:21 PM
Quote from: Lupus590 on Jan 29, 2021, 12:20 PMThere is also peripheral.find which you seem to be reimplementing: https://tweaked.cc/module/peripheral.html#v:find


Also, would this be causing the issue? and how could I make the peripheral.find better so that it wouldn't be re-implemented?

To get all of the peripherals, you could do something like this. (Returns a table/array)
local tPeripherals = table.pack(peripheral.find('thermalexpansion:storage_cell_6'))
Title: Energy Cell Power Monitor Program having issues
Post by: Lupus590 on Jan 30, 2021, 12:02 AM
Quote from: QuickMuffin8782 on Jan 29, 2021, 10:04 PMlocal tPeripherals = table.pack(peripheral.find('thermalexpansion:storage_cell'))

fixed that for you
Title: Energy Cell Power Monitor Program having issues
Post by: QuickMuffin8782 on Jan 30, 2021, 06:00 AM
Quote from: Lupus590 on Jan 30, 2021, 12:02 AM
Quote from: QuickMuffin8782 on Jan 29, 2021, 10:04 PMlocal tPeripherals = table.pack(peripheral.find('thermalexpansion:storage_cell'))

fixed that for you

Thx
Title: Energy Cell Power Monitor Program having issues
Post by: ImTehZink on Jan 30, 2021, 09:35 PM
Quote from: QuickMuffin8782 on Jan 29, 2021, 10:04 PM
Quote from: ImTehZink on Jan 29, 2021, 05:21 PM
Quote from: Lupus590 on Jan 29, 2021, 12:20 PMThere is also peripheral.find which you seem to be reimplementing: https://tweaked.cc/module/peripheral.html#v:find


Also, would this be causing the issue? and how could I make the peripheral.find better so that it wouldn't be re-implemented?

To get all of the peripherals, you could do something like this. (Returns a table/array)
local tPeripherals = table.pack(peripheral.find('thermalexpansion:storage_cell_6'))

So I changed stuff up a bit to not care about searching for the peripheral type. All I am worried about is the resonant energy cell being the one that works. The pastebin has also been updated. I added in your suggestion, but I am unsure if I did everything else to read said table correctly.