Energy Cell Power Monitor Program having issues

Started by ImTehZink, Jan 29, 2021, 09:19 AM

Previous topic - Next topic

ImTehZink

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

Lupus590

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


ImTehZink

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.

ImTehZink

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?

QuickMuffin8782

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'))
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

Lupus590

Quote from: QuickMuffin8782 on Jan 29, 2021, 10:04 PMlocal tPeripherals = table.pack(peripheral.find('thermalexpansion:storage_cell'))

fixed that for you

QuickMuffin8782

"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

ImTehZink

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.