Loog book extraction (script or savegame reading, whatever)

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Kitty
Posts: 304
Joined: Mon, 5. Sep 05, 19:59
x3tc

Loog book extraction (script or savegame reading, whatever)

Post by Kitty » Mon, 4. Sep 17, 21:14

Hello all.
Do anybody know of a tool or script able to exctract the logbook of a game?
In MSCI I find only commands to write in it.
I guess the data is in the savegame, but I don't have the keys to read it.

Many thanks,

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Mon, 4. Sep 17, 21:36

Hello

Kitty
Posts: 304
Joined: Mon, 5. Sep 05, 19:59
x3tc

Post by Kitty » Sun, 17. Sep 17, 09:43

Joubarbe wrote:Hello
Allo Joubarde. An idea of the answer ?

lostProfitssssArrgh
Posts: 161
Joined: Tue, 22. Aug 17, 13:14

Post by lostProfitssssArrgh » Tue, 19. Sep 17, 13:53

UPDATE:
- All formatting tags are now stripped, colors included.
- Empty lines are removed.
- Added curly braces {} around messages.
- Message origin is encased with <>.
- perl cascade is brutal but it works :)

Code: Select all

perl -0777 -nE 'print "{\n<$1>\n$2\n}\n" while m/(?s)\[author\](.*?)\[\/author\](.*?)\0/gm' X05 |
perl -pe 's/\[.*?(green|yellow|red|blue|magenta|orange|cyan|white|black|text.*?|select|center|author|title|justify|article?)]/ /g' |
perl -pe 's/\x20\x20?+/ /g' | perl -pe 's/^\x20|^\n//' |
perl -pe 's/\n/\r\n/' |
perl -pe 's/\x1B[A-Z]//g'> out1.txt
The messages aren't stored in order in the save file and the time-stamps are lost : that info isn't adjacent to the message content and likely stored elsewhere in binary form...
But hopefully, that's good enough.

Perl is available at the command line for Linux and OSX. For windows, you can use:
- Cygwin (perl can be called at the terminal)
- Strawberry Perl (don't know about that one, might be friendlier)

You'll need to unzip the save file before extracting the data (.sav are actually zipped containers). Replace X05 at line 1 with your save number and out1.txt at line 5 with whatever you like.

Let me know if this works for you,
-lpa

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”