-
Notifications
You must be signed in to change notification settings - Fork 1
Tips
By @Norgus.
Whole script:
sed '/^$/ d' HigurashiPS3-Script.txt | sed -e 's/^\(.*\)rv/\n\1/' | sed -r -e 's:[a-z|]*S([0-9]+/[0-9]+/[0-9a-zA-Z]+):\ns\1:g' | sed -e 's:\.:\t:' | sed -e 's:^r::' | sed -r -e '/^[^Ss]/ s/[kr]/\n/g'
For a specific range of lines in the file:
sed -n '124578,124670p' HigurashiPS3-Script.txt | sed '/^$/ d' | sed -e 's/^\(.*\)rv/\n\1/' | sed -r -e 's:[a-z|]*S([0-9]+/[0-9]+/[0-9a-zA-Z]+):\ns\1:g' | sed -e 's:\.:\t:' | sed -e 's:^r::' | sed -r -e '/^[^Ss]/ s/[kr]/\n/g'
Explained:
# print range of lines
sed -n '27271,27625p'
# remove empty lines
sed '/^$/ d'
# put character name on own line
sed -e 's/^\(.*\)rv/\n\1/'
# get rid of crap before audio paths and use new line, lowercase the S in the path
sed -r -e 's:[a-z|]*S([0-9]+/[0-9]+/[0-9a-zA-Z]+):\ns\1:g'
# replace periods (only appear after file paths) with tabs
sed -e 's:\.:\t:'
# get rid of leading "r" characters
sed -e 's:^r::'
# convert occurrences of "k" and "r" to newlines (better for matching PC script output)
sed -r -e '/^[^Ss]/ s/[kr]/\n/g'
Example output:
誘拐犯
S05/14/104700014 「ドウイウコトカ、説明スル必要ナンカ、ナイデスヨネ。
S05/14/104700015 時間ヲ差シ上ゲマスノデ、少シオ考エ下サイ。
S05/14/104700016 マタ後ホド、コチラカラ連絡イタシマス。
S05/14/104700017 ソレデハ失礼……」
犬飼
S05/00/inuk00018 「おい!
S05/00/inuk00019 待て!!
S05/00/inuk00020 もしもし?!
S05/00/inuk00021 もしもしッ?!?!」
すでに電話は切れている。
いくら怒鳴っても意味はない。
…にも拘らず、犬飼はしばらくの間、それを思いだせず、受話器に怒鳴り続けていた。
…開かれたままの引き出し。
…ぎっしり詰まったたくさんのフォルダの上にちょこんと、それは乗せられていた。
『いぬかいとしき』
平仮名で書かれた小学生の名札が、…ちょこんと。
場違いな場所に、まるで畏縮するかのように、鎮座していた…。
……覚えてるかい、雪絵。
この写真。
君に私が、初めてプロポーズをした場所だよ。
…君が頷き返してくれるまでのわずかな時間が、
私にとって、
for a given script file:
grep -P '(Output|ModPlayVoiceLS)' omake_04.txt | sed -r -e 's:^[^>]*>([^<]+)<.*:###\1:g' | sed -r -e 's:^\s*ModPlay.*"(.*)".*:\1\t:' | grep -v "^\s\+if" | sed -r -e 's:^.*"(.*)".*:\1:' | sed 's:###:\n:' | perl -p -e 's:\t\n:\t:' | sed -r -e 's:^ps./::' | sed -r -e 's:^ *::'
Explained:
# get printed lines and voices
grep -P '(Output|ModPlayVoiceLS)'
# truncate name lines to just the Japanese name preceded by ###
sed -r -e 's:^[^>]*>([^<]+)<.*:###\1:g'
# trunkate voice lines to the path + a tab
sed -r -e 's:^\s*ModPlay.*"(.*)".*:\1\t:'
# get rid of empty conditional lines
grep -v "^\s\+if"
# keep only what's in quotes on lines containing quotes
sed -r -e 's:^.*"(.*)".*:\1:'
# replace ### with newline (newline above character name)
sed 's:###:\n:'
# bring spoken lines onto same line as voice path
perl -p -e 's:\t\n:\t:'
# remove ps2 / ps3 prefix from paths
sed -r -e 's:^ps./::'
# get rid of Japanese whitespace at beginning of lines (matches PS3 script better)
sed -r -e 's:^ *::'
Example output:
レナ
……ですが、ご存知の通り、劇中にはたくさんの謎が提示されています。
それらに挑もうとした時、…この作品は初めてゲームとなるのです。」
レナ
s20/02/440200346 「プレイヤーの皆さんには、この謎に満ちた物語を様々な角度から捉え、吟味する権利があります。
レナ
s20/02/440200347 …例えば、劇中に散りばめられた謎について、推理をし、それを発表して反響を得たりすることもまた、楽しいかと思います。」
レナ
s20/02/440200348 「いよいよ…、次回のシナリオから解答編。
レナ
『目明し編(仮称)』となります。
For original script:
grep -P 'Output' Onik_PC_orig/onik_001.txt | sed -r -e 's:^.*"(.*)".*:\1:' | sed -r -e 's:^ *::' | sed -r -e 's:^\\n(\\n)?$::' | sed '/^$/ d'
For modded script:
grep -P '(Output|ModPlayVoiceLS)' onik_001.txt | sed -r -e 's:^.*"(.*)".*:\1:' | sed -r -e 's:^ *::' | sed -r -e 's:^\\n(\\n)?$::' | sed '/^$/ d' | sed '/^[<s]/ d'
(by @enumag)
First use the commands above to get the simplified script for both PC and Sui variant of the part of Higurashi you want to work on.
Now if you try to simply compare those two you get a lot of false-positives because of changes in ellipsis etc. This tool allows you to get diff just for what is actually relevant.
- Install PHP (7.1+).
- Download PHP script: https://gist.github.com/enumag/ce0a2605df445de14b53af8fb658bbc3
- Run
php apply.php <pc-file> <sui-file> <output-file>
Both of the input files need to be in the format as generated by the sed commands above. The output-file will be the pc-file with relevant changes from sui-file applied to it. Now if you compare the pc-file with output-file you should get a far better result than from simply comparing pc-file and sui-file.