All i need is an indication if the game has reached the end goal which means the victory screen was shown. How can i retrieve that information from outside the game?
currently I'm using "/sc rcon.print(game.finished_but_continuing)" but that does disable achievements.
Is there another way to fetch the finished state of the game through a rcon command that does not disable achievements?
an ugly solution may be to create a mod that will but something in the script-output folder that I then can parse but a mod would have to be installed by everyone connecting to the server which is a not preferable
command for checking "finished" game state
Re: command for checking "finished" game state
You can read the Achievement File to find if the finish-the-game-achievement has been triggered. This can be done with the factorio achievements editor on GitHub in a shell script.
Good Luck!
Good Luck!
Re: command for checking "finished" game state
You shouldn't need a mod - you can probably edit the saves control.lua to insert in additional code to make it do something else. That means its part of the saved game, so players get it automatically when they download the map. You'd need to unzip the save file to make the changes. Factorio can load an unzipped save, so you may not need to rezip it when done.darkcry wrote: Sun May 17, 2026 10:41 pm an ugly solution may be to create a mod that will but something in the script-output folder that I then can parse but a mod would have to be installed by everyone connecting to the server which is a not preferable
As an example:
Code: Select all
require('__base__/script/freeplay/control.lua')
function playerwon(event)
if event.player_won then
helpers.write_file("playerwon.txt","Player won!",false)
end
end
script.on_event(defines.events.on_pre_scenario_finished, playerwon)Adding the parts below the first line calls the function when the scenario ends - this can be due to a loss or a victory, so the first thing it does is make sure the player WON the scenario. If they did, it makes the game write out a file in script-output called 'playerwon.txt', overwriting if it exists, and containing the text 'Player won!'. You can change it to be whatever, or add ',0' to the call to make it only write it on the server.
You'd need to clear the file or track times or something when your outside tool detects it to keep it from triggering again, obviously.
Worked perfectly on a single player save.
Re: command for checking "finished" game state
very good inputs thanks!
isn't the achievement file global for one player? so regardless which save i play the achievement would only unlocked once? forgot to mention that i need a solution for each play through.
so checking the other input with the custom event inside the control.lua looks promising! i already could create a save file and adding this event into the file.
now i just have to win the game on the server
local on my pc it worked flawlessly! fingers crossed it will also work on the server. thx alot!
it will be used for my little side project https://factorio.game-challenge.net
isn't the achievement file global for one player? so regardless which save i play the achievement would only unlocked once? forgot to mention that i need a solution for each play through.
so checking the other input with the custom event inside the control.lua looks promising! i already could create a save file and adding this event into the file.
now i just have to win the game on the server
local on my pc it worked flawlessly! fingers crossed it will also work on the server. thx alot!
it will be used for my little side project https://factorio.game-challenge.net
Re: command for checking "finished" game state
If you are running "Headless" on a Server then achievements.dat will contain Achievements for that installation only; not those of each connected player. It would need to be wiped if you change the savefile.zip / start a new game.darkcry wrote: Mon May 18, 2026 4:34 pmisn't the achievement file global for one player? so regardless which save i play the achievement would only unlocked once? forgot to mention that i need a solution for each play through.
Good Luck!


