Page 1 of 1
Logging player joins
Posted: Mon Feb 27, 2017 1:51 am
by timothy_johnson
I'm running a headless Linux server, and I want to write a script that will keep track of who joins the server. Where would I find that information? I only see chat information in the logs.
Re: Logging player joins
Posted: Mon Feb 27, 2017 5:55 am
by darkfrei
timothy_johnson wrote:I'm running a headless Linux server, and I want to write a script that will keep track of who joins the server. Where would I find that information? I only see chat information in the logs.
You can add some mods to vanilla like scenario.
Please change what you need.
https://mods.factorio.com/mods/darkfrei/Build-Statistic
Re: Logging player joins
Posted: Mon Feb 27, 2017 6:35 am
by timothy_johnson
Okay, so it's a rewrite/add-on of the control.lua file. Hm. I know bash, I know python, but I don't know lua. I was hoping there was some way to do it without having to learn a new language. Thanks for the pointer, though. I'll look at it some more.
Re: Logging player joins
Posted: Mon Feb 27, 2017 7:25 am
by darkfrei
timothy_johnson wrote:Okay, so it's a rewrite/add-on of the control.lua file. Hm. I know bash, I know python, but I don't know lua. I was hoping there was some way to do it without having to learn a new language. Thanks for the pointer, though. I'll look at it some more.
Learn Lua in 15 Minutes
And all events are here
http://lua-api.factorio.com/latest/events.html
Re: Logging player joins
Posted: Mon Feb 27, 2017 7:49 am
by timothy_johnson
These links answer all my questions. You're my new favorite person.
Re: Logging player joins
Posted: Mon Feb 27, 2017 7:53 am
by Nexela
https://www.youtube.com/watch?v=S4eNl1rA1Ns It says 1 hour but after 30 minutes you will know everything lua has to offer
It is a quick language to pick up.
basically in control.lua (of a mod or scenario file)
Code: Select all
script.on_event(defines.events.on_player_joined_game, function(event)
game.write_file("PlayerJoins.txt", game.players[event.player_index].name.."\n", true) --Create a file in script_output directory with the joined players name and a carriage return. Append to file = true
end)
Re: Logging player joins
Posted: Mon Feb 27, 2017 8:06 am
by darkfrei
Timestamp
http://lua-api.factorio.com/latest/LuaG ... cript.tick
"Save to" settings
http://lua-api.factorio.com/latest/LuaG ... write_file
These links answer all my questions.
It was very difficult to start modding for me too. All tutorials are very old and can't explain what's going on in code.