NWNWiki
Register
Advertisement
NWNWiki
3,718
pages

A StringRef is a way for builders to specify strings within Neverwinter Nights. This value is an index into a talk file. (A talk file is basically a file that contains a list of strings.) When this number is less than 16,777,216 (0x01000000 in hexadecimal), this is the index of a string in the standard talk file, dialog.tlk. When this number is larger, subtracting 16,777,216 gives the index of a string in the module's custom talk file (or into the standard file if no custom talk file is found). Thus, to specify a string from a custom talk file, one would take the index of the desired string, and add 16,777,216 to it.

One advantage of using a StringRef lies in efficiency in multiplayer, as sending a 4-byte StringRef across a network consumes less bandwidth than sending a string longer than 4 characters. (The size of a string is one byte per character.)

Another advantage of using a StringRef lies in translations. Each player can have a talk file that has been translated into a preferred language, which means a string specified as a StringRef will be presented in this preferred language. Note, however, that in multiplayer, this only applies to StringRefs sent to players; the result of the function GetStringByStrRef() will be in the language used by the server, not translated by each player.

This latter advantage is somewhat negated by the ability builders have of including translations within a module. On the other hand, it may be more convenient to translate a talk file than a module. (This is the rationale BioWare has used to explain their use of talk files.)

Advertisement