Jump to content

Methods for finding and repairing broken string references


Recommended Posts

In any install with a plethora of mods it always seems like a you get at least a handful of broken dialogue/string references. 

I'm curious what the best practice is for making a mod that patches these. 

As an example, I'll use the spell SPWI604.spl (Flesh to Stone)

In my game the correct description for this modified spell exists but SPWI604.spl has the wrong string ref. for its description. 

Originally, I thought it would be easiest to use LOAD_TRA ~modname\language\something.tra~ to pull the correct descriptions right out of the language files from the original mod folder then use  SAY IDENTIFIED_DESC to patch SPWI604.spl back to it's correct description. 

But what happens when I need to patch files from an assortment of .tra's across different mods? Surely if I load them all in at the beginning of my patch the references are going to get mixed up if two .tra's share the same @#'s. 

I'm also aware that I can use SAY to just write out the full description inside " " and WeiDU will point to the string ref if it's in game or create a new one, but I feel like I might get into trouble if I'm putting things like long spell descriptions in this way. Will everything be oriented correctly in game?

Then I started looking at ACTION_GET_STRREF. So with this, it looks like I can pull an existing ref. right out of the game, store it in a variable, then possibly use SAY IDENTIFIED_DESC "variable" to assign it the correct text?

What's the best way to go about this?

Link to comment
1 hour ago, WanderingScholar said:

I can use SAY to just write out the full description inside " " and WeiDU will point to the string ref if it's in game or create a new one, but I feel like I might get into trouble if I'm putting things like long spell descriptions in this way.

There is little risk here. Even if it is not an exact match, SAY will just add a new string and set the description to it. Which is fine. The game can handle many thousands of added strings. 

But a bigger question is why this is happening in the first place. You speak as if it should be expected, but my installs include hundreds of mods and I see very few mistaken string references. You might want to run “./weidu --change-log spwi694.spl” to find out which kods changed the file. Drop the .SPL files tgat generates into /override and see which one(s) have correct descriptions. Then match up the first broken one to the --change-log output to see which mod broke it. Then you can move toward figuring out how to make an install where this doesn’t happen. 

Link to comment
25 minutes ago, subtledoctor said:

There is little risk here. Even if it is not an exact match, SAY will just add a new string and set the description to it. Which is fine. The game can handle many thousands of added strings. 

Good to know.

25 minutes ago, subtledoctor said:

But a bigger question is why this is happening in the first place. You speak as if it should be expected, but my installs include hundreds of mods and I see very few mistaken string references. You might want to run “./weidu --change-log spwi694.spl” to find out which kods changed the file. Drop the .SPL files tgat generates into /override and see which one(s) have correct descriptions. Then match up the first broken one to the --change-log output to see which mod broke it. Then you can move toward figuring out how to make an install where this doesn’t happen. 

I also only have a few, but they've been elusive to me for a while and I'd rather just patch them for the time being.  

Can you offer any insight into GET_STRREF?

Can I just do something like this:

COPY_EXISTING ~spwi604.spl~ ~override~
    GET_STRREF 121654 variable      //   correct description at ref# 121654
    SAY IDENTIFIED_DESC ~%variable%~
    BUT_ONLY

Link to comment
2 hours ago, WanderingScholar said:

Can you offer any insight into GET_STRREF?

Can I just do something like this:

COPY_EXISTING ~spwi604.spl~ ~override~
    GET_STRREF 121654 variable      //   correct description at ref# 121654
    SAY IDENTIFIED_DESC ~%variable%~
    BUT_ONLY

Don't see why not. Though, that strref may change from install to install. Just typing out the description for SAY is uch more cumbersome, but you can save this little modlet and just run it every time, without thinking about it.

Link to comment

The thing is, there's not just one cause for bad strings. For example, here's one in my tweak mod (as of now, will be fixed in the next update, which I've been working on):

My component that modifies Baeloth's ring, if installed on EET, gives that ring the wrong name and description; some completely irrelevant stuff. What happened? Well, I just made the item in NI, and the component copies it to the override. These are not new strings, but the original item's name and description - so I don't change them. Except that EET changes all the string reference numbers for BG1 strings, so now the wrong strings are being referenced.

Your idea of looking for the strings in the tra files wouldn't help. They're not there. And they won't be there after the fix either; I just compensate for the EET reindexing in code with some WRITE_LONG %loc% (THIS+200000) lines.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...