Fate/stay night:Text import

From Baka-Tsuki
Jump to navigation Jump to search

.KS file format[edit]

Game stores its dialogue texts in *.ks files which have the following structure:

@script
@script
@texton
text [l][r]
text [l][r]
...
text
@pg
*page n|
@textoff

The text to be translated is located between @texton and @textoff marks. System marks @pg, [l][r] and *page n| should be left untouched, as they are.

Word wrap[edit]

Introduction[edit]

One of the popular engines that are used in creation of visual novels is kirikiri. It doesn't support automatic word wrapping, since it was written by Japanese programmer, and solely for Japanese language (that doesn't have word wraps at all). Because of this feature of kirikiri2 (version used in creation of Fate/stay night), the text "It was a thrust like lightning. A spearhead thrust to pierce my heart. Trying to dodge it would be useless. Being lightning, it's invisible to the human eye." would be shown this way:

It was a thrust like lightning. A spe
arhead thrust to pierce my heart. Try
ing to dodge it would be useless. Bei
ng lightning, it's invisible to the h
uman eye.

To be able to use word wraps in game, one must explicitly state them. For example, the following markup:

[wrap text="It"]It [wrap text="was"]was a [wrap text="thrust"]thrust [wrap text="like"]like
[wrap text="lightning."]lightning. A [wrap text="spearhead"]spearhead [wrap text="thrust"]thrust
[wrap text="to"]to [wrap text="pierce"]pierce [wrap text="my"]my [wrap text="heart."]heart.
[wrap text="Trying"]Trying [wrap text="to"]to [wrap text="dodge"]dodge [wrap text="it"]it
[wrap text="would"]would [wrap text="be"]be [wrap text="useless."]useless. [wrap text="Being"]Being
[wrap text="lightning,"]lightning, [wrap text="it's"]it's [wrap text="invisible"]invisible
[wrap text="to"]to [wrap text="the"]the [wrap text="human"]human [wrap text="eye."]eye.

...will lead to text above being shown this way:

It was a thrust like lightning. A
spearhead thrust to pierce my heart.
Trying to dodge it would be useless.
Being lightning, it's invisible to
the human eye.

An end-of-line, if needed, is marked by symbols [l][r]:

[wrap text="It"]It [wrap text="was"]was a [wrap text="thrust"]thrust [wrap text="like"]like
[wrap text="lightning."]lightning.[l][r] A [wrap text="spearhead"]spearhead [wrap text="thrust"]thrust
[wrap text="to"]to [wrap text="pierce"]pierce [wrap text="my"]my [wrap text="heart."]heart.[l][r]
[wrap text="Trying"]Trying [wrap text="to"]to [wrap text="dodge"]dodge [wrap text="it"]it
[wrap text="would"]would [wrap text="be"]be [wrap text="useless."]useless.[l][r] [wrap text="Being"]Being
[wrap text="lightning,"]lightning, [wrap text="it's"]it's [wrap text="invisible"]invisible
[wrap text="to"]to [wrap text="the"]the [wrap text="human"]human [wrap text="eye."]eye.[l][r]

Such markup will result in showing sentences on separate lines:

It was a thrust like lightning.
A spearhead thrust to pierce my heart.
Trying to dodge it would be useless.
Being lightning, it's invisible to
the human eye.

Editing[edit]

Since typing such syntax is time- and effort-consuming, it's better to use software to automatize this work. For example, one can use xp3-wordwrap.exe utility that's included in xp3tool package, intended to work with xp3-archives. To do this:

  • Create text file and paste text you want to be processed into it
  • Save it under Win-1251 codepage (ANSI encoding) with *.ks extension
  • Create batch (*.bat) file that has input and output file names, for example:
xp3-wordwrap.exe "H:\work.ks" "C:\Fate_src\complete.ks"
  • Move it to the folder where xp3-wordwrap.exe is in and run your batch file from there
  • To be able to work with newly created complete.ks, one should open it as Win-1251-encoded text (not as the default Unicode)
  • To make work easier, one can further process resulting file. If you use Akelpad (is bundled with Total Commander):

Edit -> Replace -> What:

. [wrap text="

-> With:

.[l][r] \n[wrap text="

-> Esc-sequence (check) -> Replace all.

  • This will allow you to edit your script by substituting blocks of text.

Importing text[edit]

xp3-repack.exe utility that's included in xp3tool package as well, can create xp3-archives. This tool works in command line, but if you're going to use it often, you can use program-specific user interfaces (GUI) with it (see below).

Console[edit]

  • Create batch file (say, 123.bat) in program's folder
  • Paste the following code in it:
xp3-repack.exe directory archive.xp3 fate_full

(substitute archive.xp3 and directory with your archive and folder names)

  • Run 123.bat via Microsoft Applocale (select Japanese)

GUI[edit]

  • After unpacking place program-specific GUIs into the folder with xp3tool.
  • Run repacker.exe, input name of the file to be created and folder with scripts, then press "Go"
  • New archive is prepared.