Text: Difference between revisions
(→Unassigned element IDs: Use color swatches) |
m (byte) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
|zzt-oop name=N/A | |zzt-oop name=N/A | ||
|id=Multiple, used to encode background color: | |id=Multiple, used to encode background color: | ||
* | * {{Byte|47}}: Blue | ||
* | * {{Byte|48}}: Green | ||
* | * {{Byte|49}}: Cyan | ||
* | * {{Byte|50}}: Red | ||
* | * {{Byte|51}}: Purple | ||
* | * {{Byte|52}}: Brown | ||
* | * {{Byte|53}}: Black | ||
|color=White foreground; element ID determines background | |color=White foreground; element ID determines background | ||
|char=Any (determined by tile's color byte) | |char=Any (determined by tile's color byte) | ||
Line 20: | Line 20: | ||
'''Text''' is a terrain type that can have any of the 256 characters. Its intended use is for putting text labels on a board's terrain. | '''Text''' is a terrain type that can have any of the 256 characters. Its intended use is for putting text labels on a board's terrain. | ||
Text is the only element that can display any character without the overhead of using a [[stat]], which makes them useful for ZZT art. However, artistic usage is somewhat hampered by the fact that text can only use a fixed set of color combinations: if you want to write a sentence on the screen in a custom color (e.g., black on light gray), the only way to do it is to | Text is the only element that can display any character without the overhead of using a [[stat]], which makes them useful for ZZT art. However, artistic usage is somewhat hampered by the fact that text can only use a fixed set of color combinations: if you want to write a sentence on the screen in a custom color (e.g., black on light gray), the only way to do it is to use [[object|objects]]. | ||
Text is also the only element supported by the built-in editor that has no ZZT-OOP name: e.g., there is no way to change all text tiles to another element type. | Text is also the only element supported by the built-in editor that has no ZZT-OOP name: e.g., there is no way to change all text tiles to another element type. | ||
Line 39: | Line 39: | ||
Some known unassigned IDs and their text colors: | Some known unassigned IDs and their text colors: | ||
* | *{{Byte|54}}: {{ColorSwatch|blinking|fg=white|bg=black}} | ||
* | *{{Byte|55}}: {{ColorSwatch|blinking|fg=white|bg=dark blue}} | ||
* | *{{Byte|56}}: {{ColorSwatch|blinking|fg=white|bg=dark green}} | ||
* | *{{Byte|57}}: {{ColorSwatch|blinking|fg=white|bg=dark cyan}} | ||
* | *{{Byte|58}}: {{ColorSwatch|blinking|fg=white|bg=dark red}} | ||
* | *{{Byte|59}}: {{ColorSwatch|blinking|fg=white|bg=dark purple}} | ||
* | *{{Byte|60}}: {{ColorSwatch|blinking|fg=white|bg=dark brown}} | ||
* | *{{Byte|61}}: {{ColorSwatch|blinking|fg=white|bg=light gray}} | ||
* | *{{Byte|69}}: {{ColorSwatch|fg=white|bg=light gray}} | ||
It is impossible to choose the text foreground color because ZZT hard-codes it to be white. This means there are only 16 possible color combinations: the 7 text colors built into ZZT, and the 9 produced by the unassigned IDs above. | It is impossible to choose the text foreground color because ZZT hard-codes it to be white. This means there are only 16 possible color combinations: the 7 text colors built into ZZT, and the 9 produced by the unassigned IDs above. | ||
{{ElementsNavbox}} | |||
[[Category:Elements]] | [[Category:Elements]] |
Latest revision as of 19:20, 13 February 2021
Text | |
---|---|
Text can display any character, but color choices are limited | |
ZZT-OOP name | N/A |
Internal ID | Multiple, used to encode background color:
|
Character | Any (determined by tile's color byte) |
Default color | White foreground; element ID determines background |
Stats? | no |
Other traits | |
Effect on movement | wall |
Uses ZZT-OOP color names? | N/A |
Text is a terrain type that can have any of the 256 characters. Its intended use is for putting text labels on a board's terrain.
Text is the only element that can display any character without the overhead of using a stat, which makes them useful for ZZT art. However, artistic usage is somewhat hampered by the fact that text can only use a fixed set of color combinations: if you want to write a sentence on the screen in a custom color (e.g., black on light gray), the only way to do it is to use objects.
Text is also the only element supported by the built-in editor that has no ZZT-OOP name: e.g., there is no way to change all text tiles to another element type.
Usage of terrain color byte
Text is stored differently than any other element. Internally, ZZT repurposes the element's color byte to store character data instead: this allows the full range of characters to be encoded without having to allocate extra space (in the form of stats) for each tile. Since the color byte is occupied with other data, the actual color info is encoded by having different element IDs for each color. The result is that text is technically not just one element, but several.
Side effects from this roundabout encoding are apparent in a couple of places:
- Overwriting text (using #put or #become) will sometimes result in STK-colored elements. This is because those commands always interpret the color byte as a color: if you #put a gem onto a blue text "Z" (ASCII code 0x5A), you will get a green-on-dark-purple gem (color code 0x5A).
- Unlike most elements, it is impossible to get arbitrary text colors from toolkits or external editors. This is not a matter of ZZT's internal editor being restrictive, but rather a limit imposed by the file format and the in-memory representation.
Text is also the only element supported by the built-in editor that has no ZZT-OOP name: e.g., there is no way to change all text tiles to another element type. This may also be a side effect of text having a unique encoding.
Unassigned element IDs
ZZT only officially supports the seven text colors which have assigned element IDs. However, it is possible to get a few additional colors by using IDs beyond the assigned range, as ZZT interprets all element IDs greater than 0x2E as text. The problem is that all these IDs are buggy because they cause ZZT to read past the end of its table of elements. Touching tiles with these IDs will crash ZZT, and many unassigned IDs will crash ZZT immediately, on the first tick.
Some known unassigned IDs and their text colors:
- 54 (0x36): blinking white on black (0x8F)
- 55 (0x37): blinking white on dark blue (0x9F)
- 56 (0x38): blinking white on dark green (0xAF)
- 57 (0x39): blinking white on dark cyan (0xBF)
- 58 (0x3A): blinking white on dark red (0xCF)
- 59 (0x3B): blinking white on dark purple (0xDF)
- 60 (0x3C): blinking white on dark brown (0xEF)
- 61 (0x3D): blinking white on light gray (0xFF)
- 69 (0x45): white on light gray (0x7F)
It is impossible to choose the text foreground color because ZZT hard-codes it to be white. This means there are only 16 possible color combinations: the 7 text colors built into ZZT, and the 9 produced by the unassigned IDs above.
Elements | |
---|---|
Special | |
Items | |
Terrain | |
Creatures | |
Text |