Jump to content


Photo

Traifying REPLACE_TEXTUALLY


6 replies to this topic

#1 Grammarsalad

Grammarsalad
  • Modders
  • 450 posts
  • Gender:Male

Posted 01 May 2017 - 08:34 AM

I'm wondering if it is possible to traify REPLACE_TEXTUALLY.  Here's an example of what I have: 

 

COPY_EXISTING ~b_po010.spl~ ~override~
 READ_LONG 0x50 "valid"
  PATCH_IF (%valid% >= 0) BEGIN // verify desc is valid
  READ_STRREF 0x50 ~desc~
INNER_PATCH_SAVE new_desc ~%desc%~ BEGIN
REPLACE_TEXTUALLY ~Sphere: Healing~ ~Sphere: Life~
        END
  SAY_EVALUATED 0x50 ~%new_desc%~
 END

I would like to do something like this: 

REPLACE_TEXTUALLY ~Sphere: Healing~ @001

But, it doesn't work.. 



#2 Wisp

Wisp
  • Modders
  • 1096 posts
  • Gender:Male

Posted 01 May 2017 - 08:47 AM

You want REPLACE (I'd link it but the WeiDU readme being what it is...; it's immediately above REPLACE_TEXTUALLY).

Edited by Wisp, 01 May 2017 - 08:48 AM.


#3 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2557 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 01 May 2017 - 01:15 PM

SPRINT old @123

SPRINT new @456

REPLACE_TEXTUALLY ~%old%~ ~%new%~


"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#4 subtledoctor

subtledoctor
  • Modders
  • 2212 posts
  • Gender:Male

Posted 02 May 2017 - 12:46 PM

What Ardanis said.

The problem is, there's no way to really ensure that the translation in the mod's .tra perfectly matches the translation in the descriptions you want to change. And REPLACE_TEXTUALLY only works on perfect matches.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#5 Grammarsalad

Grammarsalad
  • Modders
  • 450 posts
  • Gender:Male

Posted 02 May 2017 - 01:19 PM

What Ardanis said.

The problem is, there's no way to really ensure that the translation in the mod's .tra perfectly matches the translation in the descriptions you want to change. And REPLACE_TEXTUALLY only works on perfect matches.

So far I'm only using it to replace in my own (and/or our) mod(s) where I can guarantee that the text will match.  

 

 

SPRINT old @123

SPRINT new @456

REPLACE_TEXTUALLY ~%old%~ ~%new%~

 

gha.  There was even an example in Weidu documentation.  Anyway, thanks.  I'll play around with it when I have a chance, but it looks like I have what I will need.

 

Edit: 

 

I'll probably go with this rather than REPLACE as there is an example (unless there is a good reason why I should use REPLACE rather than REPLACE_TEXTUALLY)


Edited by Grammarsalad, 02 May 2017 - 01:21 PM.


#6 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2557 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 02 May 2017 - 08:20 PM

And REPLACE_TEXTUALLY only works on perfect matches

 

You can still match regexp, see how IR updates descriptions. Some of the "old"s consist almost entirely of regexp code instead of normal text.

 

I'll probably go with this rather than REPLACE as there is an example (unless there is a good reason why I should use REPLACE rather than REPLACE_TEXTUALLY)

 

I believe REPLACE is used to set strrefs in text files, not for in-string replacement.


Edited by Ardanis, 02 May 2017 - 08:24 PM.

"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#7 Wisp

Wisp
  • Modders
  • 1096 posts
  • Gender:Male

Posted 03 May 2017 - 08:03 AM

Yeah, sorry. REPLACE will resolve the new text into a strref and replace old text with the strref.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users