Jump to content

Question to REPLACE_TEXTUALLY


jastey

Recommended Posts

I try to use the following in my mod:

 

 

COPY_EXISTING ~C#sococ2.bcs~ ~override~
DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~\(CreateCreature("c#sodrd2",[1251.844],0)\)~
~\1 ActionOverride("c#sodrd2",Polymorph(DRIDER_MALE))~
COMPILE_BAF_TO_BCS
BUT_ONLY_IF_IT_CHANGES

The C#sococ2.bcs exists, the "CreateCreature("c#sodrd2",[1251.844],0" is in there, too, the tp2 compiles without errors, but the change does not get applied.I am sure it's a syntax thing. If anyone spots the error, please let me know.

Link to comment

I try to use the following in my mod:

 

COPY_EXISTING ~C#sococ2.bcs~ ~override~

DECOMPILE_BCS_TO_BAF

REPLACE_TEXTUALLY ~\(CreateCreature("c#sodrd2",[1251.844],0)\)~

~\1 ActionOverride("c#sodrd2",Polymorph(DRIDER_MALE))~

COMPILE_BAF_TO_BCS

BUT_ONLY_IF_IT_CHANGES

The C#sococ2.bcs exists, the "CreateCreature("c#sodrd2",[1251.844],0" is in there, too, the tp2 compiles without errors, but the change does not get applied.I am sure it's a syntax thing. If anyone spots the error, please let me know.

 

Brackets and periods are special characters in regular expressions, so you have to 'escape' them with a backslash when you want to literally match them. One other change I've made is that if you're decompiling on an EE game, you'll either get 0 or S for the direction, so you need to match both:

 

REPLACE_TEXTUALLY ~\(CreateCreature("c#sodrd2",\[1251\.844\],[0S])\)~
Link to comment

Thank you!

 

--- Another instance of REPLACE_TEXTUALLY not working for me. Would someone tell me why the following doesn't get applied (I checked and the conditions are true, the installer evaluates the code but the text doesn#t get changed), please:

 

COPY_EXISTING ~%ALORA_JOINED%.dlg~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~Magisches Kleinzeug~ ~Allerlei Zauberei~
END
BUT_ONLY_IF_IT_CHANGES

END

Link to comment

Using the following still doesn't help, and I am at a loss:

 

COPY_EXISTING ~%ALORA_JOINED%.dlg~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY ~Magisches[%tab% %lnl%%mnl%%wnl%]+Kleinzeug~ ~Allerlei Zauberei~
END
BUT_ONLY_IF_IT_CHANGES

END

Link to comment

that's some odd regex syntax, but you could just check the exact string using dltcep, ni or whatever you are used to (weidu can dump it too).

 

But, dialogs use string references, so I also question weidu's ability to do anything there. You're not replacing actions or the dialog structure, there's another level of indirection involved. So I'd try changing the strref directly or (I guess) better yet, adding a new one and replacing its uses in the dialog.

Link to comment

I am trying to use STRING_SET but I am too dumb.

 

This gives me a parse error:

 

STRING_SET_EVALUATE @796 @3974 USING ~BG1NPC/TRA/%LANGUAGE%/x#pcinit_tmp.tra~

 

USING STRING_SET and strings in tildas didn't change the text in the game.If someone could help me out with syntax I would be very grateful.

Link to comment

When I've used STRING_SET, the first argument is the actual string number, not the text in the string. Eg:

STRING_SET 9588 ~no proficiencies for you!~
You can use NI to search for "Magisches Kleinzeug" or some part of that text, and find the string # you want to change, and plug that # into your STRING_SET command.

 

Even if STRING_SET can work with a quote like you have, it will be subject to the same problem as above if you don't get the quote exactly right. So better to just find the string.

Link to comment

This gives me a parse error:

 

STRING_SET_EVALUATE @796 @3974 USING ~BG1NPC/TRA/%LANGUAGE%/x#pcinit_tmp.tra~

STRING_SET can't take @trarefs as the first argument (@796 in you case), only #strrefs (but without the number sign) or ~strings~. I'll look into it.

Okay, this is really stupid, but different rules apply for each of STRING_SET, STRING_SET_EVALUATE and STRING_SET_RANGE. STRING_SET can only take ~strings~ as its first argument. STRING_SET_EVALUATE can take any value as its first argument and STRING_SET_RANGE I haven't looked into. @traref is not a value, so it does not parse for STRING_SET_EVALUATE. You can use RESOVLE_STR_REF to obtain a string from your @traref, but @trarefs loaded with USING won't be visible, so you'd have to move your @traref to somewhere else (e.g., the TRA file(s) loaded by LANGUAGE).

Link to comment

Thank you for your help.

 

The problam I want to solve is a different name for the Sorcerous Sundries in both classic BG1 and BG:EE. All I wanted to do is have a version with the one name (because the tra-folder should be usable without defining variables, first), and replace the name for the other game, either before or after installation. The name is mentioned inside the character's text, obviously.

 

Maybe somone sees the forst, because I only see trees atm.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...