Page 1 of 1

How to acces "Total Raw"?

Posted: Sat Oct 17, 2015 11:28 pm
by DibiZibi
Hello.

There is a nice element of the UI that shows total amount of raw materials required to craft an item.
Is there a way to access this data with a script?
It can be read only - I want to be able to count how many components are needed to construct an item.
Counting it all by hand and having a lot of it-thens in my code isn't something that I want.

Thanks for help.

Re: How to acces "Total Raw"?

Posted: Tue Oct 20, 2015 8:21 am
by SirRichie
Hi,

if the data.raw table in the wiki is up to date (it is not completely up to date, but it should be up-to-date-enough), then there is no property for what you want to get.

However, it can be implemented with a simple recursive function. You would take an item and look up its recipe. For any item in the recipe that is not part of the raw components (which will have to be defined), you call the function again and add the results.
This may actually be a helpful library for others as well. If I find the time, I may even implement it myself.

Re: How to acces "Total Raw"?

Posted: Tue Oct 20, 2015 8:31 am
by DaveMcW
I wrote a recursive function to do that a while ago.

https://forums.factorio.com/forum/vie ... 789#p34789

Re: How to acces "Total Raw"?

Posted: Tue Oct 20, 2015 6:15 pm
by DibiZibi
Thanks for help.