API call to write to the game log file

Suggestions that have been added to the game.

Moderator: ickputzdirwech

Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1330
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

API call to write to the game log file

Post by sparr »

The original idea here was a way to get data out of the game to another process. Someone on IRC suggested alerting IRC or twitch when a rocket is launched. It occurred to me that one way to do that, which would also be generally useful, would be to just be able to write a line out to the game log file.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2634
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: API call to write to the game log file

Post by steinio »

Hello,

you can write what you want to any file you want in script-output directory with game.write_file().
Also there is a rocket launched event - https://wiki.factorio.com/index.php?tit ... t_launched.

Now it's up to you to out them both together :)

Greetings steinio
Image

Transport Belt Repair Man

View unread Posts

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: API call to write to the game log file

Post by bobingabout »

don't forget you also have access to log(debug.traceback())
not sure if that's specific to data code, or if it works with other things like scripting too.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13232
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: API call to write to the game log file

Post by Rseding91 »

bobingabout wrote:don't forget you also have access to log(debug.traceback())
not sure if that's specific to data code, or if it works with other things like scripting too.
log() works anywhere and writes out to the game log file.
If you want to get ahold of me I'm almost always on Discord.

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

Re: API call to write to the game log file

Post by ssilk »

AH. Good, I wasn't sure. Now I can move it to implemented.
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 “Implemented Suggestions”