Grammarsalad Posted December 13, 2014 Share Posted December 13, 2014 I'm having trouble using this effect properly. I know that I can WRITE_SHORT 0x1c to specify a specific string (eg after copying it over to the override folder in the tp2), but I am not sure how to create a unique string. Looking at the eff format I do not see anything obvious that would allow me to do this. Any help would be appreciated. Thanks EDIT: In this case the eff file is connected to an item that 'uses eff' similar to Hold Person. Edit 2: eff 139 ha! Link to comment
lynx Posted December 13, 2014 Share Posted December 13, 2014 It takes strrefs, so there's no way around adding all the strings you want to the tlk first. Link to comment
Grammarsalad Posted December 13, 2014 Author Share Posted December 13, 2014 It takes strrefs, so there's no way around adding all the strings you want to the tlk first. Okay then, new question: How you you reference a string without knowing beforehand the StringRef # ? Link to comment
lynx Posted December 13, 2014 Share Posted December 13, 2014 I did it only once, resorting to a two stage install (querying the tlk again to get the numbers). But I'm no weidooer. Oh, one hack you could use is to just rewrite unused strrefs (STRING_SET). There's plenty of bg1-only and some funny test stuff in there that nobody should be using. Link to comment
Grammarsalad Posted December 13, 2014 Author Share Posted December 13, 2014 I did it only once, resorting to a two stage install (querying the tlk again to get the numbers). But I'm no weidooer. Oh, one hack you could use is to just rewrite unused strrefs (STRING_SET). There's plenty of bg1-only and some funny test stuff in there that nobody should be using. I was actually thinking of doing that..I only need a few strings... Thanks! (though if anybody has another idea (or a place where I can see a simple example), I'd be very grateful!) Link to comment
Thimblerig Posted December 14, 2014 Share Posted December 14, 2014 It takes strrefs, so there's no way around adding all the strings you want to the tlk first. Okay then, new question: How you you reference a string without knowing beforehand the StringRef # ? Well, you could try: OUTER_SET mystrref = RESOLVE_STR_REF (~This string, I am adding it.~) (And then use %mystrref% in your effect coding.) Link to comment
lynx Posted December 14, 2014 Share Posted December 14, 2014 cool! I guess it also works with tra references? Link to comment
Grammarsalad Posted December 14, 2014 Author Share Posted December 14, 2014 It takes strrefs, so there's no way around adding all the strings you want to the tlk first. Okay then, new question: How you you reference a string without knowing beforehand the StringRef # ? Well, you could try: OUTER_SET mystrref = RESOLVE_STR_REF (~This string, I am adding it.~)(And then use %mystrref% in your effect coding.) Cool. I will try it. Thanks Link to comment
Grammarsalad Posted December 14, 2014 Author Share Posted December 14, 2014 cool! I guess it also works with tra references? I'm guessing it's as simple as replacing ~blah~ with @#// @# = ~blah~ in tra (ha! Rhyme ta da!) Link to comment
Thimblerig Posted December 14, 2014 Share Posted December 14, 2014 cool! I guess it also works with tra references? Um, maybe? (I got the code from Wisp last year when I had a similar problem, but didn't understand it very well at the time.) Looking through the WeiDU Readme to unpack that... - The "OUTER_SET mystrref" part saves the number of the string that you've just added to DIALOG.TLK. (http://www.weidu.org/~thebigg/README-WeiDU.html#@default295) - It gets the string number from RESOLVE_STR_REF, which will assess the string you've given it and either find an existing, identical string in DIALOG.TLK and give you the number, or add the string and give you the number. (http://www.weidu.org/~thebigg/README-WeiDU.html#@default531) - RESOLVE_STR_REF takes the general argument "text", according to the Readme, which, looking up that definition... can be a string or a reference, and daisy-chaining down, "reference" can be a string ref or a tra ref @integer (http://www.weidu.org/~thebigg/README-WeiDU.html#text) I will amend my answer to "probably, but test it first." Link to comment
CamDawg Posted December 15, 2014 Share Posted December 15, 2014 You're overthinking this. Anytime you're dealing with strrefs (new strings or otherwise), think SAY. SAY takes existing strrefs, new strings, or tra references: SAY 0x1c #1 // uses existing strref 1 (essentially WRITE_LONG 0x1c 1) SAY 0x1c ~New string!~ // adds "New string!" to the tlk, and then writes the proper value to 0x1c SAY 0x1c @1 // as above, but pulls the new string from a tra file Link to comment
lynx Posted December 15, 2014 Share Posted December 15, 2014 Yes, but what if you want to use it in several places or just in tables? Link to comment
CamDawg Posted December 15, 2014 Share Posted December 15, 2014 Yes, but what if you want to use it in several places or just in tables? WeiDU is frugal when it comes to new strings so if you use repeated SAYs for the same string, they'll get set to the same value. For example: COPY ~mymod/foo.cre~ ~override~ SAY 0x08 ~Imoen~ COPY ~mymod/bar.cre~ ~override~ SAY 0x08 ~Imoen~ This will first check the tlk to see if there's an existing string of "Imoen", and if so, it will use the existing string--despite the fact that I was passing this along as if it were a new string. If I were to run this on, say, IWD where's there's no existing "Imoen" string, it would create one new string in the tlk and use it on both file copies. Tables are slightly trickier since SAY requires an offset. The general trick there is to set a temporary value where you want on the table, and then use REPLACE, e.g. COPY_EXISTING ~weapprof.2da~ ~override~ SET_2DA_ENTRY 11 3 51 ~cdssdescript~ REPLACE ~cdssdescript~ @216001 BUT_ONLY Link to comment
lynx Posted December 15, 2014 Share Posted December 15, 2014 I've used the latter approach before, but you can't really claim it's any cleaner. Link to comment
Grammarsalad Posted December 16, 2014 Author Share Posted December 16, 2014 You're overthinking this. Anytime you're dealing with strrefs (new strings or otherwise), think SAY. SAY takes existing strrefs, new strings, or tra references: SAY 0x1c #1 // uses existing strref 1 (essentially WRITE_LONG 0x1c 1) SAY 0x1c ~New string!~ // adds "New string!" to the tlk, and then writes the proper value to 0x1c SAY 0x1c @1 // as above, but pulls the new string from a tra file Ha, I feel silly! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.