Allow custom logging

Started by Pikamander2

Pikamander2 Lv 1

I'm interested in doing some analysis of how well early-game protein designs score in the late game.

Doing this by hand would be very tedious, whereas automating it would make things fairly simple. However, without being able to log the relevant data to a text file, I would have to rely on copying the data from the console, which is slower and takes a lot more effort, plus the console has a relatively small max number of lines.

It would be great if Foldit had a shared text file that recipes could log output to. To avoid taking up too much space, the program could compress/archive old logs and delete them after 30 days or whatever.

jeff101 Lv 1

Foldit already writes the Recipe Output into a file
called scriptlog.default.xml (at least on Windows)
found in your C:\Foldit directory. When a new Recipe
starts, it overwrites the old version of this file.
If you want to keep records of things, rename the
file each time you quit a recipe. I use names like
scriptlog1824a1.txt (for the 1st recipe run on client
a for puzzle 1824) and scriptlog1824c2.txt (for the
2nd recipe run on client c for puzzle 1824). I also
move all such files for a certain puzzle into a
special directory like puzz1824 when I am finished
with a puzzle. I move all the *ir_solution files
for that same puzzle into the same directory.

For more details, see:
https://foldit.fandom.com/wiki/Foldit_file_and_directory_structure#Scriptlog_files
https://foldit.fandom.com/wiki/Foldit_file_and_directory_structure#Puzzle_gameplay_files

Susume Lv 1

The filename for script output also includes the track name. If you are running in default track it is scriptlog.default.xml, but if you are running in track solo_1 the filename is scriptlog.solo_1.xml. I always include the puzzle number in my track names (eg 1824_solo1) so the scriptlog files are easy to identify. This also means a script run in one track will not overwrite the scriptlog from a different track, only the last scriptlog from the same track. Note that if you run a script with no printed output it will still overwrite that track's scriptlog.

In Lua you can set the delimiter for print statements with the delim command, for example
delim = "\t"
When you pass your printable data as comma-separated arguments to the print function, it will print them with the delimiter you have chosen. This makes it easy to produce tab-separated or comma-separated lines for easy loading into a spreadsheet.

You can also use Lua's string.format() with C-style formatting.