MindTyrant Posted November 24 Posted November 24 I am trying to replace two lines of text in dialog.tlk. I am doing so with the following code: OUTER_SPRINT recipe_short @168 OUTER_SPRINT recipe_tweak @169 STRING_SET_EVALUATE 66897 ~%recipe_short%~ STRING_SET_EVALUATE 66898 ~%recipe_tweak%~ I know you cannot specifically see everything going on here without the tra files. I am confident that you can agree this code should take the text given with @168 and @169 and replace the strings with references 66897 and 66898, at least on my machine. My concern is whether the numbers assigned to each string in dialog.tlk change installation to installation, device to device. They obviously have to change based on the games, expansions, or mods installed, correct? My dialog string references, 66,897 and 66,898 just would not be there for a non-ToB game after all (I guess although they may have different meaning for TotSC or SoD game). My question is whether there is a function like SAY, except instead of saving the string reference to offset, it saves it to variable. Then I can run it first to get string reference number, and then do something like this: XFUNCTION short_ref unedited_short XFUNCTION tweak_ref unedited_tweak OUTER_SPRINT recipe_short @168 OUTER_SPRINT recipe_tweak @169 STRING_SET_EVALUATE short_ref ~%recipe_short%~ STRING_SET_EVALUATE tweak_ref ~%recipe_tweak%~ Any help would be appreciated! Thanks in advance! Quote
jmerry Posted November 24 Posted November 24 String references in the original games will be stable, unless a mod decides to SAY a new string or something. With a few caveats: - EET increases all string references from BGEE by 200K. If it's a BG1 string you're replacing, you have to take into account trilogy versions. - New patches add incrementally more strings. Even 2.6 added a few, notably with the new character soundsets. If you're changing a string from a patch, that might change some random mod-added string in a pre-patch game. As for the the command you're looking for, that's RESOLVE_STR_REF. Input a string, add it to the TLK if necessary, return reference to that string. Quote
Jarno Mikkola Posted November 24 Posted November 24 Erhm: Do you know that weidu will seek the whole dialog.tlk and if it finds perfect reflection of the string you have, while patching the file with new strings, it won't actually add any new strings, but uses the old ones ? AND it needs to be perfect refection, so typo, will create a new string with the typo. But; COPY ~sw1h01.itm~ SAY NAME1 ~ < already used perfectly replicated strings > ~ Will not do a thing.. to the dialog.tlk ... Quote
jmerry Posted November 24 Posted November 24 Well, yes, that's how it works. That's not a problem for any of this. Note: it has to be a perfect match, including flags and sound. Viconia swearing "Vith'os" is not the same as "Vith'os" without the sound. The usual [ ] conventions can be used to include a sound with your string. Quote
MindTyrant Posted November 24 Author Posted November 24 (edited) 4 hours ago, jmerry said: As for the the command you're looking for, that's RESOLVE_STR_REF. Input a string, add it to the TLK if necessary, return reference to that string. Ok, thanks. But I looked at it weidu documentation, and it says "Resolves the given text (adding it to the tlk), and returns its TLK index (so you can pass the result of this command to a function which then uses WRITE_LONG rather than SAY)." Will that pass the result to a variable instead of a function? 3 hours ago, Jarno Mikkola said: Erhm: Do you know that weidu will seek the whole dialog.tlk and if it finds perfect reflection of the string you have, while patching the file with new strings, it won't actually add any new strings, but uses the old ones ? AND it needs to be perfect refection, so typo, will create a new string with the typo. Thanks for the warning, between the two of you, I need something like this: //in main .tpa component WITH_SCOPE BEGIN OUTER_SET tweak=RESOLVE_STR_REF(This text is said word-for-word, character-for-character in the unmodded game.) OUTER_SPRINT recipe_tweak @169 STRING_SET_EVALUATE tweak ~%recipe_tweak%~ END //elsewhere in .tra file @169 = ~This text is changed, and even minor, character for character appear in the modded game.~ Ugghhh... These are the kind of changes I have found difficult to test. The only way I know would require reinstalling the whole game just to see how it responds to each change. It's not like creating a new resource with near infinity and loading it up with the console. I have no idea how to test properly... Obviously, I will need to sub in the actual game text and my real edits... and I think every line of these is action context, please let me know if you see otherwise. Do either of you know if the above code looks correct, at least in syntax? 3 hours ago, Jarno Mikkola said: But; COPY ~sw1h01.itm~ SAY NAME1 ~ < already used perfectly replicated strings > ~ Will not do a thing.. to the dialog.tlk ... Right, because the string perfectly reflected. But I want to change the text in the dialog.tlk. Sorry I am not sure what you mean. Edited November 25 by MindTyrant Accidental premature submission Quote
Recommended Posts
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.