Page 1 of 1

Expose historical data of LuaFlowStatistics

Posted: Sat May 08, 2021 2:55 am
by Wiwiweb
Image

Using LuaFlowStatistics.get_flow_count, I can get any data in the green box.
I want to get the data in the red box.

Something like get_flow_count_at_timestamp() that would take a prototype name and a game tick timestamp, and return the production rate and/or count at that timestamp.

Why?
I'm looking to create a mod that records the time of the first creation of an item, and I would like it to be able to find that retroactively, if the mod is added to an existing save file.

Thanks!

Re: Expose historical data of LuaFlowStatistics

Posted: Sat May 08, 2021 3:14 pm
by NotRexButCaesar
I believe the values are also stored with more significant digits than displayed, so this could act as a way to get more precise values for testing builds in the editor.

Re: Expose historical data of LuaFlowStatistics

Posted: Mon Jun 07, 2021 1:23 am
by Wiwiweb
My mod is released now.

https://mods.factorio.com/mod/Milestones

I ended up adding a manual input so players can copy values from the production graphs.

But I'm hoping I can update that to be automatic in the future, wink nudge ;)

Re: Expose historical data of LuaFlowStatistics

Posted: Fri Nov 19, 2021 5:03 pm
by Raiguard
Bump. Having milestones work retroactively with greater precision would be awesome!

Re: Expose historical data of LuaFlowStatistics

Posted: Thu Mar 03, 2022 10:07 pm
by stillmoms
Another bump from me. As someone who discovered Milestones after getting 800 hours deep into Space Exploration, it’d be nice to be able to get more detailed statistics on when I first did something than “somewhere between 48 hours and 858 hours”.

Re: Expose historical data of LuaFlowStatistics

Posted: Wed Apr 20, 2022 3:56 pm
by dubax
Bump. Also would love to see the functionality of this mod be better!

Re: Expose historical data of LuaFlowStatistics

Posted: Mon Jun 06, 2022 2:44 pm
by Xorimuth
This is implemented in 1.1.60 as the sample_index parameter to LuaFlowStatistics.get_flow_count.

Re: Expose historical data of LuaFlowStatistics

Posted: Tue Jun 07, 2022 11:51 pm
by Wiwiweb
I released a new version of Milestones which uses this new parameter and it now works very well when added to existing games :D

Estimations before.
Estimations after.

Thanks Xorimuth!