jmerry Posted January 4, 2023 Share Posted January 4, 2023 I'm working on a mod component that does global patching of party member AI scripts (to deal with weirdness around Project Image). Scripts like BDDEFAI and its counterparts for recruitable NPCs are easy enough to handle. But those aren't the only scripts that can be assigned. The .BS files that live in the "Scripts" folder are also usable, and I'd like to apply the same patch to them. While the file format is identical - you could rename a .BCS to .BS or vice versa without any change in function - it's still a different extension. And all of the WeiDU commands are about working with .BCS and .BAF files. There isn't a single mention of .BS files in the WeiDU documentation. Is there any way to edit a .BS file that doesn't go the indirect route of making a .BCS file at some intermediate step and then renaming it? Quote Link to comment
CamDawg Posted January 4, 2023 Share Posted January 4, 2023 (edited) Yes, COMPILE assuming the output to be a BCS and in the override folder is a little annoying. However, before we had DECOMPILE_AND_PATCH BEGIN ... END, we had paired commands of DECOMPILE_BCS_TO_BAF and COMPILE_BAF_TO_BCS actions. The easiest way to add a BS script, for example, is simply this: COPY ~mymod/myscript.baf~ ~scripts/myscript.bs~ COMPILE_BAF_TO_BCS If you want to edit BS files, you can also just COPY ~scripts/agen.bs~ ~scripts/agen.bs~ DECOMPILE_BCS_TO_BAF // REPLACE_TEXTUALLY or whatever COMPILE_BAF_TO_BCS BUT_ONLY You can't COPY_EXISTING_REGEXP through the folder. However, since all the scripts are there as files, you can wrap the above in an ACTION_BASH_FOR: ACTION_BASH_FOR ~scripts~ ~^.+\.bs$~ BEGIN COPY ~%BASH_FOR_FILESPEC%~ ~%BASH_FOR_FILESPEC%~ DECOMPILE_BCS_TO_BAF // REPLACE_TEXTUALLY or whatever COMPILE_BAF_TO_BCS BUT_ONLY END (I'm using ACTION_BASH_FOR from memory, so the syntax of the directory/regexp may not be 100%.) edit: Now that I'm thinking about it, I think you can still use DECOMPILE_AND_PATCH BEGIN ... END in the second and third cases (and should, since it's preferred syntax). WeiDU will respect the destination file name in a COPY regardless of which patch actions are being brought to bear--it's only the one-offs like COMPILE that assume the extension and destination folder. Edited January 4, 2023 by CamDawg Quote Link to comment
jmerry Posted January 4, 2023 Author Share Posted January 4, 2023 Right, got it. ACTION_BASH_FOR to find the files, then DECOMPILE_AND_PATCH wrapping an INSERT_FILE because EXTEND_TOP is one of those one-offs that assumes destination. And make sure to end that BAF I'm inserting with some newlines. Looks like it should work. Thanks for the help. And now, time to start testing all the stuff I've written. 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.