Computercraft and Ender IO Programming Question

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

VestigeOfHope

New Member
Jul 29, 2019
21
0
0
So I'm writing a computercraft program similar to what DW20 did on forgecraft, except I'm trying to write so that I can expand it to more than one turbine/reactor when I'm ready to do so. The only real issue I'm running into right now is that in DW20's code he uses a method capacitor.getMaxEnergyStored(), but when I use that same method my program hangs up and doesn't proceed.

Here is a copy of my code so far: pastebin.com/2wAe78CT

The block of code between lines 246 and 250 are where the program freezes up. the print("test") on line 246 shows up fine, but the other prints after that do not.

Anyone know whats going on?
 
You are aware that getMaxEnergyStored() and getEnergyStored() are two different things, right? getMaxEnergyStored() should pretty much always tell you the same thing - the maximum amount of energy that can be stored in the single capacitor you're connected to. It doesn't tell you the max energy for the whole bank, and it doesn't tell you the current energy level for the whole bank.

It looks like you're aware of this from the code, just making sure you aren't expecting that number to actually change.

When I tested pretty much the same code fragment (attached to my capacitor bank of 106 capacitors surrounding a single energy tesseract) I got a reading of 2,650,000,000 and two seconds later, a reading of 2,650,000,000

When I queried for capacitor.getEnergyStored() and multiplied the result by 106 (number of capacitors I had), I got 2,579,831,074 instead of the true capacitor amount of 2,555,493,133 which was unexpected. It seems like its calculation is off by one, which is a little funky.
 
I don't know. Maybe something is wrong with the getdev function.
Have you tried making a small test program which does nothing more than calling getMaxEnergyStored() ?
 
No, his getdev function seems to be fine as long as you're calling it with the right types, which he is.
EnderIO seems to be one update behind when requesting energy levels. e.g., when I break blocks on a full bank of capacitors attached to a computer reading the energy levels, it will initially seem to show accurate values, but as you continue to break (and replace) blocks, the reported energy level appears to be one block-break event behind the actual numbers reported.

In practice, this probably won't really be noticed because the capacitor should constantly update as energy flows in and out of it, keeping reporting pretty accurate. My scenario of creatively bashing and replacing capacitor blocks is a rather unrealistic corner case.
 
You are aware that getMaxEnergyStored() and getEnergyStored() are two different things, right?
Yeah, I'm using the max to calculate the percentage of how full the capacitors are. I'll make a smaller test program later tonight to see if its the method or my program doing something wierd
 
So I tested this in a smaller test program and got the same exact problem
Code:
c = peripheral.find("tile_blockcapacitorbank_name")

print("test start")
print(c.getMaxEnergyStored())
print("test end")

This will display the test start but not the test end.
And apparently it doesn't matter if I use getMaxEnergyStored() or getEnergyStored(), both have the same issue.
 
So apparently this is caused by project red
Ive found the issue, Project Red causes the crash due to an outdated Computercraft API, it needs to be updated past version 58 or removed.

So I guess I wait for DW20 1.0.4
 
So I tested this in a smaller test program and got the same exact problem
Code:
c = peripheral.find("tile_blockcapacitorbank_name")

print("test start")
print(c.getMaxEnergyStored())
print("test end")

This will display the test start but not the test end.
And apparently it doesn't matter if I use getMaxEnergyStored() or getEnergyStored(), both have the same issue.

Hmm. I ran the same code and it worked fine. But I *have* updated all the mods in the pack to their current versions, so yeah, it's possibly a bug in a version of a mod specific to the 1.0.3 release.

I can't stand playing with bugs, so when I see a moddev has fixed a bug in their pack, I can't help but get the fix in quick. :-) Sometimes that bites me in the rear, but most times I'm good.

Usually a new release of the DW20 pack doesn't affect me much unless they add/remove a mod or make a config tweak. I can't predict those.
 
I would update all my mods myself as well, except I play on a server with friends who probably wouldn't be able to update themselves.

In the mean time, I'll see if I can get the system to work based of the energy buffer of the turbines