The NPC speech and random dialog in the .tab files are added as strings, so the clients cannot choose which language to use for them. These strings can all be added as resources in library.kod, allowing client translation.
To do so, each string in the tab files needs to be made into a resource with a unique name, as do any triggers. For example:
BarloqueApothecary LIBRES_MOOD_GOOD bye ~kJoguer says, "Must thou make such haste in thy departure? I shall be sorry to see thee go."
becomes
LT_bye = "bye"
LM_joguer_bye = \
"Must thou make such haste in thy departure? I shall be sorry to see thee go."
This is then added to the speechlib init code in CreateSpeechLibrary:
plSpeechLib = Cons([&BarloqueApothecary,[
[[LT_bye],LIBRES_MOOD_GOOD,[LIBACT_SAY,LM_joguer_bye]]
]],plSpeechLib);
CreateSpeechLibrary is used for speech triggers and CreateRandomLibrary for random triggers. Some NPCs already have lists in these messages, and the converted .tab entries should be placed into the existing lists.
Some .tab entries require more modification, for example:
BarloqueClerk hello ~kCaramo says, "Welcome to the office of the Justicar, %NAME."
To use this as a resource, the %NAME substring should be converted into definite article/name as follows:
LM_caramo_hello = "Welcome to the office of the Justicar, %s%s."
The corresponding list entry would be:
plSpeechLib = Cons([&BarloqueClerk,[
[[LT_hello],0,[LIBACT_SAY_TARG,LM_caramo_hello]]
]],plSpeechLib);
LIBACT_SAY_TARG is a LIBACT_SAY type action that adds the target's definite article and name, and there are several LIBACT_SAY types that should cover most of the strings in the .tab files.
Some strings aren't meant to be directly said by the NPC, for example:
BarloqueInnKeeper stunted dwarf ~kThe room goes silent as %NAME mentions stunted dwarf.
These strings will need new LIBACT action types (LIBACT_SAY_ROOM_MSG or similar) to cover them.
Solution
Create a parser that:
- Scans library.kod and loads its resource names (and possibly the trigger text) into a table to avoid duplicates.
- Loads library.kod's speech and random list entries into a list by NPC.
- Reads the trigger and dialog from (English) .tab or .txt files and generates a unique resource name of the form type_classname_description, with type LT for trigger and LM for dialog.
- Generates an appropriate speech or random lib list entry based on the formatting in the dialog (LIBACT_SAY type), and store this new entry in the appropriate parser list.
- Output all the data when the tab/txt file has finished being parsed, and stick it all into library.kod.
May need to manually create the German resources, though I assume a lot of them can be accurately guessed by a parser based on matching trigger/mood.
The NPC speech and random dialog in the .tab files are added as strings, so the clients cannot choose which language to use for them. These strings can all be added as resources in library.kod, allowing client translation.
To do so, each string in the tab files needs to be made into a resource with a unique name, as do any triggers. For example:
BarloqueApothecary LIBRES_MOOD_GOOD bye ~kJoguer says, "Must thou make such haste in thy departure? I shall be sorry to see thee go."becomes
This is then added to the speechlib init code in CreateSpeechLibrary:
CreateSpeechLibrary is used for speech triggers and CreateRandomLibrary for random triggers. Some NPCs already have lists in these messages, and the converted .tab entries should be placed into the existing lists.
Some .tab entries require more modification, for example:
BarloqueClerk hello ~kCaramo says, "Welcome to the office of the Justicar, %NAME."To use this as a resource, the %NAME substring should be converted into definite article/name as follows:
The corresponding list entry would be:
LIBACT_SAY_TARG is a LIBACT_SAY type action that adds the target's definite article and name, and there are several LIBACT_SAY types that should cover most of the strings in the .tab files.
Some strings aren't meant to be directly said by the NPC, for example:
BarloqueInnKeeper stunted dwarf ~kThe room goes silent as %NAME mentions stunted dwarf.These strings will need new LIBACT action types (LIBACT_SAY_ROOM_MSG or similar) to cover them.
Solution
Create a parser that:
May need to manually create the German resources, though I assume a lot of them can be accurately guessed by a parser based on matching trigger/mood.