Jump to content


Photo

Changing Strings in dialog.tlk


  • Please log in to reply
15 replies to this topic

#1 OneEyedPhoenix

OneEyedPhoenix
  • Member
  • 308 posts

Posted 18 September 2009 - 11:20 AM

Is it possible to change the text at specific StringRef's in dialog.tlk, with Weidu or near infinity, without corrupting the rest of the file?

Edited by OneEyedPhoenix, 18 September 2009 - 11:24 AM.


#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 18 September 2009 - 11:54 AM

STRING_SET 12345 @100

Retired from modding.


#3 OneEyedPhoenix

OneEyedPhoenix
  • Member
  • 308 posts

Posted 18 September 2009 - 12:20 PM

STRING_SET 12345 @100


I take that as a definitive yes.
Please bear with me, I'm learning...

#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 18 September 2009 - 12:27 PM

Since you've mentioned weidu already, I assume you know how to run it. For the testing purpose, try this
BACKUP ~mymod/backup~

AUTHOR ~OneEyedPhoenix~



BEGIN ~Changing text~



STRING_SET 123 ~This is the 123th line.~

STRING_SET 124 ~This is the 124th line.~

STRING_SET 125 ~This is the 125th line.~

STRING_SET 126 ~This is the 126th line.~

Retired from modding.


#5 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 18 September 2009 - 12:34 PM

If you don't know the specific numerical reference (for example, if you're changing something added by a mod which changes from one install to another), you can substitute the 123 for the existing text. So:
STRING_SET ~Old text~ ~New text~

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#6 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 18 September 2009 - 12:41 PM

If you don't know the specific numerical reference (for example, if you're changing something added by a mod which changes from one install to another), you can substitute the 123 for the existing text. So:
STRING_SET ~Old text~ ~New text~

Actually, don't (unless you use tra references). That synthax is very problematic and there's a real risk it gets parsed the wrong way by WeiDU.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#7 OneEyedPhoenix

OneEyedPhoenix
  • Member
  • 308 posts

Posted 18 September 2009 - 01:12 PM

No worries. The Strings I had in mind are from vanilla BG2.

#8 Salk

Salk
  • Modder
  • 1411 posts

Donator

Posted 24 May 2021 - 11:03 PM

Okay, I realize I am resurrecting a whooping 12 years old thread but I was wondering if MIloch's advice up there was sound.

 

I needed to change one word in a string and I did as he suggested because the numerical reference could vary. The only difference being I use a .TRA file.

 

STRING_SET  ~OldText~ @100

 

It did work without problems but then the bigg recommended to not do that.


Is there a better way to do it?


Edited by Salk, 24 May 2021 - 11:03 PM.


#9 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 24 May 2021 - 11:28 PM

...


Is there a better way to do it?


The obvious, use 2 .tra references, not just 1. As you have no idea if the bugger went and installed the English mod to a German game.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#10 Salk

Salk
  • Modder
  • 1411 posts

Donator

Posted 24 May 2021 - 11:31 PM

Okay, I can do that of course.

 

I was wondering if there was a better way than using STRING_SET.



#11 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 25 May 2021 - 12:00 AM

I was wondering if there was a better way than using STRING_SET.


Well, there are certain cases where YOU HAVE to do this, there are others that you don't, but to figure that out, you need to give us a case there to use it, or...


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#12 Salk

Salk
  • Modder
  • 1411 posts

Donator

Posted 25 May 2021 - 12:39 AM

I am changing a BGT-WeiDu string.

 

I can't trust it to always have the same string reference so I cannot really use STRING_SET # for it.


Edited by Salk, 25 May 2021 - 12:39 AM.


#13 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 25 May 2021 - 02:50 AM

I am changing a BGT-WeiDu string.


wHICH PART ?

Sorry, had the Caps Lock in place. See, it's not really a BGT-WeiDu -string if it's a string featured in say item description coming with the mod, it's an item description string, so you edit the .itm... not an actual example. It's not a dialog string, in which case you edit the .dlg, nor is it a Graphical User Interface string in which case you don't cheese up the GUI, so you might need to use the SET_STRING or do it in other ways ... each of which has several ways to do things. But to give a further instructions, we would need an actual example. Not ... your brain fart, for an example, cause it's not.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#14 Salk

Salk
  • Modder
  • 1411 posts

Donator

Posted 25 May 2021 - 08:40 PM

Okay, here it comes:

 

Original Line: "I said a quota of four per party! Get out of here and watch your back because I report all poachers to the Flaming Fist, damn hammer-happy fools!"

 

New Line: "I said a quota of ten per party! Get out of here and watch your back because I report all poachers to the Flaming Fist, damn hammer-happy fools!"

 

I just want to change a word (from four to ten).



#15 skellytz

skellytz
  • Staff
  • 478 posts

Posted 26 May 2021 - 01:54 PM

TRA
 

@1 = ~I said a quota of four per party! Get out of here and watch your back because I report all poachers to the Flaming Fist, damn hammer-happy fools!~ // old string
@2 = ~I said a quota of ten per party! Get out of here and watch your back because I report all poachers to the Flaming Fist, damn hammer-happy fools!~ // new string

 
TP2
 

OUTER_SET old_string = RESOLVE_STR_REF(@1)

COPY_EXISTING ~gerde.dlg~ ~override~
  DECOMPILE_AND_PATCH BEGIN
    REPLACE_TEXTUALLY ~SAY #%old_string%~ ~SAY @2~
  END

Edited by skellytz, 26 May 2021 - 02:09 PM.


#16 Salk

Salk
  • Modder
  • 1411 posts

Donator

Posted 26 May 2021 - 08:21 PM

Excellent. Thanks skellytz.