tes3cmd: mass-restoring fallen dialogue entries

3 posts / 0 new
Last post
Rot's picture
Rot
Lead DeveloperDeveloperQuest Developer
Joined:
2014-03-16 17:45
Last seen:
2 weeks 1 day ago

(notes on how to move back many dialogue entries at once after they’ve fallen to the bottom of the ocean by some glitch or other)

Install tes3cmd in the Data Files folder, backup your files, etc.;
use tes3cmd v0.37 (the modify function doesn't work in v0.40 alpha)
Set up command line calls with a batch (.bat) file is advised, or else call command line window on Data Files;
Make text dumps of vanilla & TR records so you can look up IDs in them when necessary (attached);
Make text dump of the plugin you’re fixing, likewise,
Taking the example of “background” entries in the Indoril-Thirr merge:

tes3cmd dump --type DIAL --type INFO "TR_IndorilThirr_v.0110.esp" > "IndorilThirr_Dial.txt"

Look up the entry above which you want to move dialogue in the topic – can be in vanilla or TR. For this example let’s assume we’re moving these entries just above the top entry in Tribunal:

 

Record: INFO "2583529070786213408" (Topic:background) Flags:0x0000 ()
  INAM: ID:2583529070786213408
  PNAM: Prev_ID:
  NNAM: Next_ID:1219922361199448922
  DATA: Disposition:0  Rank:None  Sex:None  PC_Rank:None
  ONAM: Actor:vonos veri
  NAME: Response: I am %name, I serve Almalexia as one of Her Hands.

We’ll need the ID of this one: 2583529070786213408,

Look up the top and bottom of the entries you want to move in the plugin dump:

 

Record: DIAL "background" Flags:0x0000 ()
  NAME: ID:Background
  DATA: Type:(Topic)

Record: INFO "20552131232024725953" (Topic:background) Flags:0x0000 ()
  INAM: ID:20552131232024725953
  PNAM: Prev_ID:666731499111789993
  NNAM: Next_ID:139911068589699159
  DATA: Disposition:0  Rank:None  Sex:None  PC_Rank:None
  ONAM: Actor:dialog placeholder
  NAME: Response: END TR MAP4

[...]

Record: INFO "18859804930419111" (Topic:background) Flags:0x0000 ()
  INAM: ID:18859804930419111
  PNAM: Prev_ID:1365326427523025261
  NNAM: Next_ID:
  DATA: Disposition:0  Rank:None  Sex:None  PC_Rank:None
  ONAM: Actor:dialog placeholder
  NAME: Response: END DONRIL AND SURROUNDINGS BACKGROUNDS

in this case we’ll respectively delete (replace with nothing) the Prev_ID (=666731499111789993) of the top one so nothing is above it (if it needs to be placed somewhere specific, find the ID that goes above instead), and replace (since there is nothing, add with the character ^) the bottom’s Next_ID (empty) with the ID of the top Tribunal entry so it ends up positioned above it:

tes3cmd modify --type info --exact-id "20552131232024725953" --sub-match "Prev_id:" --replace "/666731499111789993//" TR_IndorilThirr_v.0110.esp
&
tes3cmd modify --type info --exact-id "18859804930419111" --sub-match "Next_id:" --replace "/^/2583529070786213408/" TR_IndorilThirr_v.0110.esp

Restricting to info-type and to the precise id of the entry to be modified is a necessary precaution;
Restricting to sub-match "Next_id:" or sub-match "Prev_id:" is the only way to replace an empty field.

And check in the CS.

ADDENDUM:
obviously typing strings is more error-prone than editing in the CS so use .bat files in which you paste the tes3cmd command lines so you don't have to type these long IDs.
Still better to prevent the reference loss from happening when merging plugins in the first place. Always make sure that newly merged entries are not placed at the very top, or very bottom, of the dialogue list for Greetings and common topics because these positions deprive your added entries of an upper (resp. lower) reference. If entries only have a lower reference they have twice the chances of dropping after merges not true: the "previous" reference is the only one that counts, and "nothing" counts as a legitimate previous reference. What doesn't count as a previous reference is an ID that isn't found, and that's when dialogue falls to the bottom. So placing dialogue at the very top is technically safer, and the old wisdom was wrong.

AttachmentSizeDate
File dialogue dumps.7z3.3 MB2016-10-26 22:40
10Kaziem's picture
10Kaziem
Lead DeveloperDeveloperInterior Developer
Joined:
2015-12-12 23:47
Last seen:
5 months 4 days ago

Seems like a valuable resource to keep around. Let me know if/when this is relatively finished and I can toss it into the handbook or an appropriate spot so it doesn’t get lost.

Does: concepts, textures, youtube vids, admin stuff e.g. PR, handbook, assets, small website things. Activity level: wildly unpredictable. Still active. Find me on Discord.

Rot's picture
Rot
Lead DeveloperDeveloperQuest Developer
Joined:
2014-03-16 17:45
Last seen:
2 weeks 1 day ago

Another remedial, also better avoided but in some cases cleaner than the above,

1. find which was the latest stable version of the file for dialogue, ie the latest one in which dialogue for that active file (starts * in the CS) is not at the bottom.

2. make sure dialogue wasn't changed between that stable and your current version with bugged dialogue (changes to dialogue also include changes to the IDs of objects or NPCs involved in dialogue, or changes in cell names),
if you don't find changelogs, rollback till the latest documented version or try to do an export and compare with tes3cmd and the text tool of your choice. If you can identify these changes and they are minimal, you can reapply them to the stable version and proceed with the next steps. If they're not minimal, either consider the tes3cmd ID-replace method or roll back.

3. delete all dialogue data from the current version in TESAME (everything with types "Topic" and "Info/Responce"), and save the result as your world file,

4. delete all non-dialogue data from the stable version in TESAME (everything except the above two types and the initial "TES3"), and save this as your dialogue file,

5. load your world file and dialogue file in the Construction Set, making sure the dialogue file loads last (making it the Active file does that),
You will need use the corresponding version of TR_Mainland.esp as an ESM and load it along both.

6. combine the loaded plugins, then remove the added ESM dependence in Wrye Mash