Is it possible to print a message out to the console in game during the on_init event?
game.print(message) doesn't actually seem to output anything during this event. I know the function I've assigned to it is firing because a log(message) in the same function does output to the log. It's just that sometimes it's easier to get needed debugging output from right within the game vs alt+tabbing -> reload file -> scroll scroll scroll (especially when trying to test compatibility with other mods that are outputting to the log as well).
Print to game console during on_init?
-
- Smart Inserter
- Posts: 2765
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Print to game console during on_init?
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: Print to game console during on_init?
It won't solve your question, but I use logexpert (or `tail` on linux) to watch the game log if I'm debugging and don't have factorio launching with the dedicated console window in the background. I would recommend it.FuryoftheStars wrote: ↑Fri Feb 24, 2023 3:49 amIs it possible to print a message out to the console in game during the on_init event?
game.print(message) doesn't actually seem to output anything during this event. I know the function I've assigned to it is firing because a log(message) in the same function does output to the log. It's just that sometimes it's easier to get needed debugging output from right within the game vs alt+tabbing -> reload file -> scroll scroll scroll (especially when trying to test compatibility with other mods that are outputting to the log as well).
Re: Print to game console during on_init?
I think it is possible if there are players in the game. This would be the case in single player mode when on_init is run because your mod has been added to a running game. It wouldn't work when you start a new game (there is no player yet that could see the message), and it shouldn't work in multiplayer mode (because on_init will run before on_player_joined_game).FuryoftheStars wrote: ↑Fri Feb 24, 2023 3:49 amIs it possible to print a message out to the console in game during the on_init event?
game.print(message) doesn't actually seem to output anything during this event.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
-
- Smart Inserter
- Posts: 2765
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Print to game console during on_init?
Crap, I was afraid that was what it was going to come around to. Alright, thanks.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics