166
Lix Levels / Scripts for level maintainers
« on: June 29, 2016, 06:13:39 AM »
Are you on Linux? Make your life easy with scripts de luxe!
Windows users: If you're cmd-savvy, a Powershellist, or use Python, please share your Windows scripts, too.
Strip level from replays
You maintain replays for your awesome level pack. Replays may include a copy of their level. Lix has weird rules on whether to run the replay against the included level, or against the pointed-to level. To guarantee that Lix uses the pointed-to level at any time, strip the level from each replay file.
Both of the following solutions rely on how all levels' first lines begin with $BUILT<space>. The editor consistently saves like this, but it's not specced anywhere.
From all levels recursively found within the current directory, we extract the number of lix, then compute the sum.
find . -name '*.txt' -exec grep "\#INITIAL " {} \; | awk '{s+=$2}END{print s}'
Mass-verify replays
Verify all levels recursively found in the given directory replays/path/to/your/dir. Lix will check all replays against their pointed-to level, then output which replays solve, or don't solve.
This command is the same in any Windows or Linux shell:
lix --coverage replays/path/to/your/dir
-- Simon
Windows users: If you're cmd-savvy, a Powershellist, or use Python, please share your Windows scripts, too.
Strip level from replays
You maintain replays for your awesome level pack. Replays may include a copy of their level. Lix has weird rules on whether to run the replay against the included level, or against the pointed-to level. To guarantee that Lix uses the pointed-to level at any time, strip the level from each replay file.
Both of the following solutions rely on how all levels' first lines begin with $BUILT<space>. The editor consistently saves like this, but it's not specced anywhere.
- geoo's solution: The Python script is attached to this post. It creates new replay files without the levels.
- Alternatively, the following Bash one-liner modifies replays in place. It doesn't keep backups. It recurses through subdirectories.
find . -name \*.txt -exec sed -i '/\$BUILT /Q' {} \;
From all levels recursively found within the current directory, we extract the number of lix, then compute the sum.
find . -name '*.txt' -exec grep "\#INITIAL " {} \; | awk '{s+=$2}END{print s}'
Mass-verify replays
Verify all levels recursively found in the given directory replays/path/to/your/dir. Lix will check all replays against their pointed-to level, then output which replays solve, or don't solve.
This command is the same in any Windows or Linux shell:
lix --coverage replays/path/to/your/dir
-- Simon