Jump to content

Copying multiple files from mod folder to game folder


grogerson

Recommended Posts

I've crafted a mod to add the twelve additional soundset from IWD2 into IWD1, including the subtitles. Testing seems to work, with one important exception. The sound folders are created, the Charstr.2da updates with the new soundset names and strings, but the .wav files aren't copying to the new folders. Since each soundset has 40 files, I want to copy them all with a single .tp2 command line from the mod subdirectory to the game Sound directory.

 

Each soundset installs separately, so the mod has twelve components.

 

What I've found so far is that COPY and COPY_EXISTING_REGEXP aren't working as I've coded them, and to use a basic DOS command line I'd have to call an external batch file like Kulyok did with her IWDNPC mod (which is the template for my coding). My coding skills aren't very good, and the WeiDU readme is a little difficult to work through in this case for me.

 

This was my last attempt at coding:

COPY_EXISTING_REGEXP ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1\2BFF.*.wav~ ~override~
MOVE (~override~ ~^[2BFF].*\.wav$~) ~Sounds\FEMALE_BARBARIAN_1~

Seems COPY_EXISTING_REGEXP looks at the CHITIN.KEY file, doesn't find it, and faults out.

 

Anyone willing to get me going the the right direction?

Link to comment

I use a modified manual version -

 

 

BEGIN @30014   // installing oneunique forced subcomponent of several
    FORCED_SUBCOMPONENT @30011 // the master set of options
    REQUIRE_COMPONENT ~setup-aranw.tp2~ ~0~ @30017 // only if the mod is installed
    COPY ~aranw/media/g3blank.mus~         ~music~   // you have other ways of doing this
    COPY_EXISTING ~songlist.2da~         ~override~ // you have other ways of doing this
        SET_2DA_ENTRY 0 2 3 ~g3blank.mus~ // you have other ways of doing this
        BUT_ONLY

    LAUNCH_ACTION_MACRO ~chooseasoundtrack~ // just changes what these files are based on user choice, renaming unique files to a generic
    ACTION_CLEAR_ARRAY    ~sounds~
    ACTION_DEFINE_ARRAY ~sounds~ BEGIN // list of all the sounds to be dealt with
        ~c-aws001~
        ~c-aws002~
        ~c-aws003~
        ~c-aws004~
        ~c-aws005~
        ~c-aws006~
        ~c-aws007~
        ~c-aws008~
        ~c-aws009~
        ~c-aws010~
        ~c-aws011~
        ~c-aws012~
        ~c-aws013~
        ~c-aws014~
        ~c-aws015~
        ~c-aws016~
        ~c-aws017~
        ~c-aws018~
        ~c-aws019~
        ~c-aws020~
        ~c-aws021~
        ~c-aws022~
        ~c-aws023~
        ~c-aws024~
        ~c-aws025~
        ~c-aws026~
        ~c-aws027~
        ~c-aws028~
        ~c-aws029~
        ~c-aws030~
        ~c-aws031~
        ~c-aws032~
        ~c-aws033~
        ~c-aws034~
        ~c-aws035~
        ~c-aws036~
        ~c-aws037~
        ~c-aws038~
        ~c-aws039~
        ~c-aws040~
        ~c-aws041~
        ~c-aws042~
        ~c-aws043~
        ~c-aws044~
        ~c-aws045~
    END
    /* look for the resulting .wavc files and copy them into the game */
    ACTION_PHP_EACH ~sounds~ AS ~index~ => ~sound~ BEGIN
        ACTION_IF (NOT FILE_EXISTS_IN_GAME ~%sound%.wav~) BEGIN
            COPY ~aranw/media/wavc/%sound%.wav~ ~override~
        END
    END
    PRINT @30009 // yep, we installed 'em
Link to comment

cmorgan's way should work, but there are a couple of other options.

 

If you arrange your mod so that each soundset is placed in a separate folder, you can perform a COPY on the folder, which will copy each item in the folder to the specified destination.

MAKE_DIR ~sounds~ // ensure directory exists

COPY ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1~ ~sounds~

If you don't want to copy all of the files from a folder and you don't want to hardcode a list of specific files, you can use ACTION_BASH_FOR to filter the list of files in a directory via regular expression.

MAKE_DIR ~sounds~ // ensure directory exists

ACTION_BASH_FOR ~IWD2_Sounds_for_IWD1\Sounds\Female_Barbarian_1~ ~^2BFF.*\.wav$~ BEGIN
  COPY ~%BASH_FOR_FILESPEC%~ ~sounds~
END
Link to comment

@cmorgan - Too complicated for me. And I'm also dealing with character soundsets, not music.

 

@Mike1082 - So simple with the COPY command, and it works. When I first tried it I had to screw it up with trying to copy the files too much like DOS. Thanks bunches.

 

Now I found another problem, this time with the CHARSTR.2DA file. FEMALE_BARBARIAN_1 and MALE_BARBARIAN_1 are two soundsets for example. If I install the female soundsets first, the male soundsets won't appear, but if I install the male soundsets first both show up.

 

I'd like to keep it with each soundset installed individually, but this may require a complete single install instead. Any ideas what causes this problem, and how to fix it. My mod appears fully functional but for this one issue.

Link to comment

Jarno, I suspect it's because they start with MALE_ and FEMALE_, and if the female is installed first WeiDU sees (fe)male and fails to update the .2DA. More than that I can't say. Here's the section that deals with the problem.

APPEND ~charstr.2da~ ~Male_Barbarian_1 2BFM001 2BFM002 2BFM003 2BFM004 2BFM005 2BFM006 2BFM007 2BFM008 2BFM009 2BFM010 2BFM011 2BFM012 2BFM013 2BFM014 2BFM015 2BFM016 2BFM017 2BFM018 2BFM019 2BFM020 2BFM021 2BFM022 2BFM023 2BFM024 2BFM025 2BFM026 2BFM027 2BFM028 2BFM029 2BFM030 2BFM031 2BFM032 2BFM033 2BFM034 2BFM035 2BFM036 2BFM037 2BFM038 2BFM039 2BFM040~
UNLESS ~Male_Barbarian_1~
COPY_EXISTING ~charstr.2da~ ~override~
/* Male_Barbarian_1 */
REPLACE 2BFM001 @280

I have thought about it, though, and have a workable solution - installing the male and female sets for the barbarian, bard, drow, half-orc, monk and sorcerer in pairs. This way I can keep the naming conventions of the two games without worry that someone will install the female soundset first and not have the male soundset subtitles.

 

I'll finish the mod up, then ask to have it hosted here, either in the Miscellaneous Mods or Icewind Dale Mods forum.

Link to comment

Your suspicions are correct. Having UNLESS ~Male_Barbarian_1~ prevents the APPEND from occurring if the file contains Male_Barbarian_1 anywhere, including cases like Male_Barbarian_10 or Female_Barbarian_1.

 

You can fix this by changing the UNLESS to be more strict. I suggest UNLESS ~^Male_Barbarian_1[ %TAB%]~. That will only prevent the APPEND when the file contains a line that starts with Male_Barbarian_1 and is followed by a space or tab.

Link to comment

@Mike1072 - Thank you very much. That did the trick. That makes two lessons learned in WeiDU coding. Now all I need to do is do a quick check that they read properly in game, then make my submission and request.

Link to comment

Archived

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

×
×
  • Create New...