Transfer data between games

Place to get help with not working mods / modding interface.
Post Reply
Theis
Inserter
Inserter
Posts: 27
Joined: Tue Sep 13, 2022 9:57 am
Contact:

Transfer data between games

Post by Theis »

Is it possible for a mod to store some data in game A, and then for the mod to load that data in game B?

For instance, you have a time trial mod. Where the goal is produce the most iron-plates in 30 minutes.
So to compare, you would first run the time trial and produce 1020 iron-plates.
Then next time you try you produce 1312 iron-plates.
Is there anyway for the mod to compare those two values and print the information of how much you have improved?

I can see it is possible:
- to read information from settings.global, but it does not appear possible to write data there.
- to write data to script-output, but I can't find any methods reading it.

I understand that this might be impossible, but I would like to be sure.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 624
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Transfer data between games

Post by Xorimuth »

It is possible with the use of an external program running outside of factorio at the same time. Data out is done by write_file which you already found. Data in must be done using RCON: https://lua-api.factorio.com/latest/LuaRCON.html
This page doesn’t seem to explain very much and I can’t find the page that does right now. But it is definitely possible for mods to receive RCON messages from external programs.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Theis
Inserter
Inserter
Posts: 27
Joined: Tue Sep 13, 2022 9:57 am
Contact:

Re: Transfer data between games

Post by Theis »

Okay that sounds cumbersome to say the least, but I guess it is better than nothing.
I have absolutely zero experience with RCON, so let me try to wrap my head around it.

I would then need to setup an RCON client (maybe https://github.com/mark9064/factorio-rcon-py)
I would then need to launch Factorio in RCON server mode, and connect the client and the server.
Then I have a path to send messages out of Factorio and console commands into Factorio.
Then I just need to use the messages outside factorio to write ....

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Transfer data between games

Post by Bilka »

You can write to your own mod settings: https://wiki.factorio.com/Tutorial:Mod_ ... n_settings. However, this is only useful for transfer of data between saves if the player has the setting "Use different mod settings per save" turned off.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Modding help”