Lauriel Posted October 9, 2020 Share Posted October 9, 2020 (edited) 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 October 9, 2020 by Lauriel Quote Link to comment
Lauriel Posted October 9, 2020 Author Share Posted October 9, 2020 (edited) Nevermind - had to use DialogueInterrupt instead of what is shown when you export the BAF from NI. Problem solved. Edited October 9, 2020 by Lauriel Quote Link to comment
jastey Posted October 10, 2020 Share Posted October 10, 2020 I think you can cover both by using "Dialogu?e?" or something. Quote Link to comment
Lauriel Posted October 10, 2020 Author Share Posted October 10, 2020 9 minutes ago, jastey said: I think you can cover both by using "Dialogu?e?" or something. I'll keep that in mind, thanks! Quote Link to comment
Mike1072 Posted October 10, 2020 Share Posted October 10, 2020 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\)". Quote Link to comment
DavidW Posted October 10, 2020 Share Posted October 10, 2020 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. Quote Link to comment
Lauriel Posted October 10, 2020 Author Share Posted October 10, 2020 (edited) 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 October 10, 2020 by Lauriel Quote Link to comment
CamDawg Posted October 10, 2020 Share Posted October 10, 2020 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. Quote Link to comment
Lauriel Posted October 11, 2020 Author Share Posted October 11, 2020 (edited) 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 October 11, 2020 by Lauriel Quote Link to comment
Lauriel Posted October 11, 2020 Author Share Posted October 11, 2020 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? Quote Link to comment
Mike1072 Posted October 11, 2020 Share Posted October 11, 2020 IESDP is your best bet. Quote Link to comment
Recommended Posts
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.