If I enter this command into the console I will get a text file in my script-output dir with the correct number of iron plates consumed:
Code: Select all
/c game.write_file("iron-plate.txt" , game.player.force.item_production_statistics.get_output_count("iron-plate"))
Code: Select all
/c script.on_event(defines.events.on_tick, function(event)
if event.tick % 60*5 == 0 then --every 5 seconds for testing only. Increase to 10 min when working
game.write_file("iron-plate.txt" , game.player.force.item_production_statistics.get_output_count("Iron-plate"))
end
end)
Error while running event level::on_tick (ID 0)
(command):1: attempt to index field 'player' (a nil value)
stack traceback:
(command):1: in function <(command):1>
This method/command structure is working for count.entities.filtered and count.tiles.filtered with no problem using a slightly different command but I can’t seem to get production stats to export.
I’m not a programmer so if someone could post the correct command I should be using I would really appreciate it - the API references aren't helping me, sadly.
Thanks in advance!