STR
The string table. Every piece of text in the map is here, and other sections refer to it by number: the scenario name and description, force names, location names, custom unit names, switch names, sound file names, and the text and sounds of trigger actions.
The section starts with the number of strings, then one offset per string, counted from the start of the section, and then the text. Each string ends with a 0 byte. String numbers count from 1: the first offset is string 1. Several strings may share the same offset. Because the offsets are 16-bit, the whole table must fit in 64 KB.
The table does not say how its bytes spell characters. StarEdit wrote the code page of the
Windows it ran on: EUC-KR (CP949) for Korean, Shift_JIS for Japanese, GBK or Big5 for
Chinese, Windows-1251 for Russian, Windows-1252 for the rest. 1.16.1 reads a file in the
code page of the machine it runs on. Remastered reads STR as UTF-8 when the bytes are
valid UTF-8, and in the local code page when they are not. How scmJS guesses the encoding
is in Opening and saving maps.
| Name | STR␠ (53 54 52 20) |
|---|---|
| Size | Whatever the text needs. |
| Read by | The game. |
| Required | Yes. The game does not load a map without it. |
| More than one copy | Only the last copy counts. |
| In scmJS | Read, and written again when you change what it holds. |
Layout:
| Offset | Type | Holds |
|---|---|---|
| 0 | u16 | How many strings there are |
| 2 | u16 × that many | Where each string starts, counted from the start of the section |
| after the offsets | text | The strings, each ending in a 0 byte |
A string runs from its offset to the next 0 byte, and nothing else marks where it ends. So two strings can share their bytes, one string can be the end of another, and an offset can point anywhere in the section, the offset table included. An offset at or past the end of the section leads to no text, and an editor has to read it as no string.
StarEdit writes a table of 1024 strings, and points every unused one at a single 0 byte straight after the offsets: an empty string. Every Blizzard map checked is laid out this way.
Example#
A table of three strings, the first and the third the same text. The third shares the first one's bytes, and the lone 0 after the offsets is where an unused string would point:
0 03 00 3 strings
2 09 00 string 1 starts at 9
4 0F 00 string 2 starts at 15
6 09 00 string 3 starts at 9
8 00 a lone 0: an empty string
9 48 69 6C 6C 73 00 "Hills" and its 0
15 46 6F 72 63 65 20 31 00 "Force 1" and its 0
Control codes#
Bytes 0x01 to 0x1F in a string are not characters. Most set the colour of the text after
them, and a few align it, hide it or cut it short. Editors write them as <XX>, the byte
in hexadecimal, and the game draws the text from the byte where the code stands. In
1.16.1 each new line of a string starts in the default colour again; in Remastered a
colour carries on to the next line of the same string.
| Byte | Written | What it does |
|---|---|---|
| 0x01 | <01> |
Mimic (keeps the current colour) |
| 0x02 | <02> |
Colour: Cyan (#b8b8e8) |
| 0x03 | <03> |
Colour: Yellow (#dcdc3c) |
| 0x04 | <04> |
Colour: White (#ffffff) |
| 0x05 | <05> |
Colour: Grey (#847474) |
| 0x06 | <06> |
Colour: Red (#c81818) |
| 0x07 | <07> |
Colour: Green (#10fc18) |
| 0x08 | <08> |
Colour: Red — player 1 (#f40404) |
| 0x09 | <09> |
Tab |
| 0x0A | <0A> |
Newline |
| 0x0B | <0B> |
Invisible |
| 0x0C | <0C> |
Remove beyond (newline in the small font) |
| 0x0D | <0D> |
Carriage return |
| 0x0E | <0E> |
Colour: Blue — player 2 (#0c48cc) |
| 0x0F | <0F> |
Colour: Teal — player 3 (#2cb494) |
| 0x10 | <10> |
Colour: Purple — player 4 (#88409c) |
| 0x11 | <11> |
Colour: Orange — player 5 (#f88c14) |
| 0x12 | <12> |
Right align |
| 0x13 | <13> |
Centre align |
| 0x14 | <14> |
Invisible |
| 0x15 | <15> |
Colour: Brown — player 6 (#703014) |
| 0x16 | <16> |
Colour: White — player 7 (#cce0d0) |
| 0x17 | <17> |
Colour: Yellow — player 8 (#fcfc38) |
| 0x18 | <18> |
Colour: Green — player 9 (#088008) |
| 0x19 | <19> |
Colour: Brighter yellow — player 10 (#fcfc7c) |
| 0x1A | <1A> |
Nothing |
| 0x1B | <1B> |
Colour: Pinkish — player 11 (#ecc4b0) |
| 0x1C | <1C> |
Colour: Dark cyan — player 12 (#4068d4) |
| 0x1D | <1D> |
Colour: Grey-green (#74a47c) |
| 0x1E | <1E> |
Colour: Blue-grey (#9090b8) |
| 0x1F | <1F> |
Colour: Turquoise (#00e4fc) |