Page 1 of 1

export energy stats to file

Posted: Wed Sep 20, 2017 8:31 pm
by blendi_93
hello,

i try to export energy stats to file (so i can use them for my led strip), i want something like a satisfaction bar in reallive ;).

unfortunately my solution causes fpsdrops (1 each 60 tick).

do u know a "better" method to read values like produced energy and "used" energy?

i have only 2.3k Accumlators, 1.8k solar panels and 53 steamengines, without my mod its fine.

attached my "mod".

Re: export energy stats to file

Posted: Wed Sep 20, 2017 8:37 pm
by olafthecat
You know.
Here's a reply.
Might get someone else to fix your problem.
Issue is, I have no idea what you are are talking about.
Good luck!

Re: export energy stats to file

Posted: Wed Sep 20, 2017 9:31 pm
by Adil
Well, for me it doesn't really work because, firstly, you try to iterate over dictionary (non-number keys) with `ipairs`, secondly, because solar panel has `energy` equal to zero always. I've fixed first issue below, for the second one I don't know workaround.
Code
Maybe you should make a request, so that devs would export the energy_production_statistics per force, like they do for item_production_statistics.

Re: export energy stats to file

Posted: Thu Sep 21, 2017 5:01 am
by blendi_93
thx for ur reply.

adding new generators didnt work, cause "global.energy_sources[entity.type]" has the keys 1 2 3 4 changed to global.energy[entity.type]

HUGE thx, using entity.unit_number resolved the performance problem, next: stupid solar panels ;)

attached my current version, if interrested.

Re: export energy stats to file

Posted: Sun Mar 25, 2018 5:40 pm
by Edris89
really looking forward to this one. cause i too wanted to react a ledstrip with factorio.
If you someone could help would be awesome