Hooks for gui values

Place to get help with not working mods / modding interface.
Hopewelljnj
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Nov 03, 2016 4:58 am
Contact:

Hooks for gui values

Post by Hopewelljnj »

I have a friend who streams and does videos for youtube and he wanted to be able to pull some production stats and power stats into OBS. If I could access them it would be as simple as moving those values to a text file he could parse. However we currently have no hooks into that information.

My suggestion is that since you are already calculating all the data and naturally storing it somewhere in the memory, is to add hooks for modders to be able to pull data from the production and electric network screens.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Hooks for gui values

Post by daniel34 »

You can write a small mod (or even include it into the control.lua of the savefile) that periodically gathers the information you're looking for and writes it to an external file with LuaGameScript.write_file, which you then can parse with an external tool.
quick links: log file | graphical issues | wiki
Hopewelljnj
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Nov 03, 2016 4:58 am
Contact:

Re: Hooks for gui values

Post by Hopewelljnj »

This is what I would like to do. However currently to my knowledge there are no ways to grab the power usage or to grab production values. That is the issue.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Hooks for gui values

Post by daniel34 »

Hopewelljnj wrote:This is what I would like to do. However currently to my knowledge there are no ways to grab the power usage or to grab production values. That is the issue.
For production values use http://lua-api.factorio.com/latest/LuaF ... stics.html
Example that shows the production values (the same as in the [P] Production window - tab All) for eg. iron plate:

Code: Select all

/c game.player.print(game.player.force.item_production_statistics.get_input_count("iron-plate"))
Use get_output_count for consumption values.
LuaForce also has values for fluid consumption, resources, entity build counts and kill counts.

I don't think there currently is an easy way to read power usage statistics using lua, you might ask in the Modding help or Modding interface requests forums.
quick links: log file | graphical issues | wiki
Hopewelljnj
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Nov 03, 2016 4:58 am
Contact:

Re: Hooks for gui values

Post by Hopewelljnj »

Thanks.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Hooks for gui values

Post by ssilk »

Moved from suggestions to modding help
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Post Reply

Return to “Modding help”