DeHackEd / BEX Reference/BEX Extension: STRINGS Block

From Eternity Wiki
Jump to: navigation, search

The basic Dehacked file is understood and properly evaluated to change such things as sounds, frame rewiring, Thing attributes, etc. No change is required to the original .deh file for those things. However, text is handled differently in BEX for several reasons:

1. Dehacked by the nature of the program was simply doing a search and replace action on the strings as found in the executable. This is clumsy and dangerous, though as good as can be done when dealing with a compiled executable program. We now have the ability to change the actual string values during play, a safer and better solution.

2. Because Dehacked used the original string to find the place to plug in the replacement, there was no way to write a generic hack that would replace strings in all versions regardless of language. In BEX, the strings are identified by their names, which are the same in all cases.

3. Because Dehacked was replacing strings in a physical location in the program file, it was limited to approximately the same size string as the original. Though this is generally practical, it is limiting in flexibility. BEX allows any length string to replace any of the ones in the game (this also applies to cheats).

4. The purpose of replacing a string is to show the player some text at a particular point in the game. Finding the original text that was there and replacing it with other text worked, but logically what the author should have been able to do was assign strings depending on the desired purpose, and not have to recognize the original text to do so. In BEX, all strings are identified by a mnemonic name (actually the name of the internal variable), making it easier to assign a string to its desired purpose.

Detailed information is available further down in this file, explaining the mnemonic codes that are used for all the replaceable strings. Note that some of the strings are always displayed in the small (uppercase only) font, so capitalization is not important for those.

We urge patch authors to provide new BEX format files, for clarity, supportability and flexibility.

Back to DeHackEd / BEX Reference

Syntax[edit]

To use BEX string support, start the section with a [STRINGS] section marker, followed by lines that start with the key mnemonic, an equal sign, and the value to assign to that string. You may split the value to be assigned onto multiple lines by ending each line that is to be continued with a backslash. Don't put quotes around the string if you don't want them to show up in the result. A couple of examples:

  # Change the level name that shows up in the automap for MAP12:
  [STRINGS]
  HUSTR_12 = The Twelfth Night
  # and now the new red key message for switches
  PD_REDO = You need the scarlet pimpernel to \
            turn on this machine.   
  # Note that the blank before the backslash is included in the string
  # but that the indentation before the word "turn" is not, allowing
  # the change file to be easy to read.