Jump to content

REPLACE_TEXTUALLY DialogInterrupt Not working


Lauriel

Recommended Posts

I have a line of code to replace and, for the life of me, I can't get WeiDU to do it.  Here's the original code block:

Spoiler


IF
	Global("BD_VISITED_BD0109","GLOBAL",0)
THEN
	RESPONSE #100
		ActionOverride("bdnhilva",DialogInterrupt(FALSE))
		ActionOverride("BDGARRIC",DialogInterrupt(FALSE))
		SetGlobal("BD_VISITED_BD0109","GLOBAL",1)
		Continue()
END

 

Here's my tiny bit of code to do the replacement:

REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH ~ActionOverride("BDGARRIC",DialogInterrupt(FALSE))~ ~ActionOverride("BDGARRIC",DestroySelf()) RemoveMapNote([806.325],%STRREF_GARRICK%)~

Running that produces no changes.  But if I use:

REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH ~SetGlobal("BD_VISITED_BD0109","GLOBAL",1)~ ~ActionOverride("BDGARRIC",DestroySelf()) RemoveMapNote([806.325],%STRREF_GARRICK%)~

I end up with the following - as expected:

Spoiler


IF
	Global("BD_VISITED_BD0109","GLOBAL",0)
THEN
	RESPONSE #100
		ActionOverride("bdnhilva",DialogInterrupt(FALSE))
		ActionOverride("BDGARRIC",DialogInterrupt(FALSE))
		ActionOverride("BDGARRIC",DestroySelf())
		RemoveMapNote([806.325],214319)  // Garrick
		Continue()
END

 

What's up with DialogInterrupt that it can't be found and replaced by WeiDU?

Edited by Lauriel
Link to comment
22 hours ago, Lauriel said:

What's up with DialogInterrupt that it can't be found and replaced by WeiDU?

WeiDU is decompiling the .bcs file into a .baf file.  The .bcs file doesn't contain either of these options, it contains "179".  There are two different identifiers in actions.ids that correspond to that value.  When WeiDU decompiles the .bcs file, it has to find the corresponding identifier for 179 and swap that in.  If there are multiple identifiers, it can't put all of them in, so it picks one of them.  It seems to prefer the last one in the file (DialogueInterrupt).  The IESDP notes that the action.ids file in BG1/IWD1/IWD2 has DialogInterrupt but no DialogueInterrupt, so on those platforms, the line in your .bcs file would decompile to DialogInterrupt instead.

13 hours ago, jastey said:

I think you can cover both by using "Dialogu?e?" or something.

Yep, that would match Dialog, Dialogu, Dialoge, and Dialogue.  A regex for just Dialog and Dialogue would be "Dialog\(ue\)?" or "\(Dialog\|Dialogue\)".

Link to comment
2 hours ago, Mike1072 said:

WeiDU is decompiling the .bcs file into a .baf file.  The .bcs file doesn't contain either of these options, it contains "179".  There are two different identifiers in actions.ids that correspond to that value.  When WeiDU decompiles the .bcs file, it has to find the corresponding identifier for 179 and swap that in.  If there are multiple identifiers, it can't put all of them in, so it picks one of them.  It seems to prefer the last one in the file (DialogueInterrupt).  The IESDP notes that the action.ids file in BG1/IWD1/IWD2 has DialogInterrupt but no DialogueInterrupt, so on those platforms, the line in your .bcs file would decompile to DialogInterrupt instead.

That's extremely interesting.  And thank you for the regex equivalent, too. :)

20 minutes ago, DavidW said:

As general advice when REPLACE_TEXTUALLY fails on a dlg or bcs file: use WEIDU itself to decompile it and look at, instead of NI. You can do it at the command line.

For beginners, the syntax for that is: weidu <filename>.BCS but I think the syntax suggested by jastey and Mike is the better way to go.

Thanks all!

Edited by Lauriel
Link to comment
2 hours ago, Mike1072 said:

Yep, that would match Dialog, Dialogu, Dialoge, and Dialogue.  A regex for just Dialog and Dialogue would be "Dialog\(ue\)?" or "\(Dialog\|Dialogue\)".

Use the latter. The problem with the former is that it will throw off your replacement tokens depending on whether it decompiles with "ue". E.g.

REPLACE_TEXTUALLY ~Dialog\(ue\)?("\(foo\)")~ ~Interact("\2")~

will fail on a match for ~Dialog("foo")~ because it only matches one group, not two.

Also of note: while scripts are compiled/decompiled and go through the process Mike1072 describes, dialogues themselves store actions and triggers as plain text. What you see in NI is what you need to match.

Link to comment
35 minutes ago, CamDawg said:

What you see in NI is what you need to match.

That's what I did, and that's what failed and started this discussion. :)  But as you said, that was because it was a script, not a dialogue.  I would be easier for me to use a single method for both, though.  So I think I'll stick with Mike and jastey's syntax since it seems to be global.  Unless I'm missing something.

Edited by Lauriel
Link to comment
3 hours ago, Mike1072 said:

WeiDU is decompiling the .bcs file into a .baf file.  The .bcs file doesn't contain either of these options, it contains "179".  There are two different identifiers in actions.ids that correspond to that value.  When WeiDU decompiles the .bcs file, it has to find the corresponding identifier for 179 and swap that in.  If there are multiple identifiers, it can't put all of them in, so it picks one of them.  It seems to prefer the last one in the file (DialogueInterrupt).  The IESDP notes that the action.ids file in BG1/IWD1/IWD2 has DialogInterrupt but no DialogueInterrupt, so on those platforms, the line in your .bcs file would decompile to DialogInterrupt instead.

Is there a list of oddities like these somewhere, for future reference? 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...