Jump to content

could someone help make a file copying macro?


smeagolheart

Recommended Posts

Hey guys, I'm messing with soundsets. BGEE, BG2EE, IWDEE each have different requirements for what sound files they would need, I'm pretty confused.

 

I'm looking for help to write/help me figure out how to copy this set of files for each game.

 

The files would have the %soundName% variable.

 

So %soundName%a(.wav) would be copied for all three games but %soundName%0 should only be copied if IWDEE.

 

There are a ton of little variations... Well at least a few if not a ton. can someone help get me started? What do I need here? I would think action_ifs dependent on games. Possibly launch patch macro or something. I 'm not real familiar with those functions - yet.

 

Please advise when you have a chance, thanks.

Link to comment

I was hoping to break it down to individual filenames based on the variable and not have separate folders or something. I'm hoping to make something easy for other people to use and if I could get a macro or something to split it up instead of asking everyone to make 3 folders I think it'd be helpful to people.

 

 

The whole breakdown of what goes where is somewhat messy with some needing to go into 2 out of the 3 games but not necessarily the same two out of three depending on the file name.

 

So I was hoping to leave the soundsets in one folder instead of three or four folders each set, you know what I mean? But maybe that's too much of a pain in the neck.

 

 

Here's the breakdown, if my interpretations and cross-references of charsnd.2da, csound.2da and sndslot.ids are right...

 

IWDEE only

------

*0.wav

*_.wav

*#.wav

*w.wav

 

IWDEE and BG2EE only (not BG1EE)

-----

*s.wav

*t.wav

*u.wav

*v.wav

 

and everything else goes to all three games.

 

The 0 extension is something of a special case as it should make noise in BG1/BG2 because it's listed in csound.2da and sndslot.ids but I think not display subs because it's not listed on a row in charsnd.2da so I don't want it copied for sure if the games not IWDEE

Link to comment

I would just separate the sounds by folder for installation purposes. You could get fancy with regexp, but I don't even know if it works with COPY (for existing game files, you'd use COPY_EXISTING_REGEXP). If it did, it'd be something like this:

ACTION_IF GAME_IS ~iwdee~ BEGIN

COPY ~mymod\\sounds\\^.+[0_#w]\.wav$~ ~sounds~

END

 

ACTION_IF NOT GAME_IS ~bgee~ BEGIN

COPY ~mymod\\sounds\\^.+[s-v]\.wav$~ ~sounds~

END

Or you can just COPY the explicit files for each game, i.e. put in a laundry list of COPYs for each GAME_IS.

Link to comment

Can you tell me if I am understanding regexp here, I've never used it before:

 

so for this:

\\^.+[0_#w]\.wav$~

 

Need two of these \\

then ^.+[(each letter)].wav$

correct?

 

this wouldn't be for existing game files, only stuff attached with the mod.

 

At most 33 entries of the copies.

 

could I have a

\\^.+[abcdefgh...]\.wav$~

 

whole bunch of letters on one of those?

 

And I guess I should put those in a patch macro or something?

Link to comment

So I couldn't get the regexp thing working, maybe it's only for copy_existing

 

So I guess I'm going with this, ugly but seems to work:

			ACTION_IF FILE_EXISTS ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ THEN BEGIN
				COPY ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ ~lang/en_US/sounds~ END
			ACTION_IF FILE_EXISTS ~S9Soundsets/SND/%soundName%/sounds/%soundName%b.wav~ THEN BEGIN
				COPY ~S9Soundsets/SND/%soundName%/sounds/%soundName%b.wav~ ~lang/en_US/sounds~ END
			ACTION_IF FILE_EXISTS ~S9Soundsets/SND/%soundName%/sounds/%soundName%c.wav~ THEN BEGIN
				COPY ~S9Soundsets/SND/%soundName%/sounds/%soundName%c.wav~ ~lang/en_US/sounds~ END

etc....

Feel free to suggest a better way if there's one, if not that's what I'm going with 31 entries lol for IWDEE

 

Link to comment

Well, this is academic if COPY doesn't support regexp (could've sworn someone requested COPY_REGEXP ages ago but I don't see it in the documentation.

could I have a

\\^.+[abcdefgh...]\.wav$~

 

whole bunch of letters on one of those?

Consult the doc linked above, but \ quotes special characters (so \\ quotes a literal backslash). If you have a range of adjacent characters e.g. [abcdefgh] then [a-h] is equivalent to that.

 

And I guess I should put those in a patch macro or something?

You don't really need a macro for your purpose, which is just copying files. Normally a macro or function would be a good chunk of code reused under multiple circumstances.

 

If you want to compact your code, you can do something like:

 

ACTION_FOR_EACH soundname IN ~laundry~ ~list~ ~of~ ~sounds~ ~you~ ~want~ ~to~ ~copy~ BEGIN

ACTION_IF FILE_EXISTS ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ BEGIN // Dunno if you need to check whether a file exists in your own mod, might be able to skip this

COPY ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ ~lang/en_US/sounds~

END

END

 

You could also nest another ACTION_FOR_EACH if you have a bunch of extensions (a, b, c etc.) and then nest that whole thing in the ACTION_IF GAME_IS checks.

Link to comment

Don't see how ACTION_FOR_EACH soundname IN ~laundry~ ~list~ ~of~ ~sounds~ ~you~ ~want~ ~to~ ~copy~ BEGIN would help, I still need to see if the thing exists...



ACTION_IF FILE_EXISTS ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ BEGIN // Dunno if you need to check whether a file exists in your own mod, might be able to skip this


COPY ~S9Soundsets/SND/%soundName%/sounds/%soundName%a.wav~ ~lang/en_US/sounds~



I've attached what I have now, please take a look.. If I can shrink those first 225 lines to something less newb intimidating it would help when Joe Newb opens this and doesn't have to scroll down so far to see that he only has to add a couple lines for a soundset.



I'll be backporting (sideporting?) this to the shell I'm making for the community here:


http://forum.baldursgate.com/discussion/37760/how-to-awesome-soundsets-vol-0-soundset-mod-shell#latest


That people can add their own soundsets so I can't have this crashing if a file is missing (hey, maybe the guy just wants to make a BG1 soundset with only a couple files, what do I know, right?)


Setup-S9soundsets.tp2

Link to comment

BGEE, BG2EE, IWDEE each have different requirements for what sound files they would need, I'm pretty confused.

 

I'm looking for help to write/help me figure out how to copy this set of files for each game.

 

The files would have the %soundName% variable.

 

So %soundName%a(.wav) would be copied for all three games but %soundName%0 should only be copied if IWDEE.

 

Are you sure you can't just copy over all the sounds in the soundset, regardless of what game the mod is installed on? It shouldn't harm anything if there is an extra sound file hanging around that never gets used.

COPY ~S9Soundsets/SND/%soundName%/sounds~ ~sounds~
Link to comment
I specifically ran into a problem in my tests with copying over an "n" sound. I don't want to copy over everything. It played the underground sound with no subtitles even though it seems like it shouldn't have.


Also I ran a test on BGEE it was playing extended sounds (normally only e f g selection sounds in that one) but without subs on the extended ones. So another reason not to copy everything.


I believe it will play anything there's an extension for listed in csound.2da but will write subs only for things listed in charsnd.2da which requires you to reference sndslots.ids to figure out what the rows mean.


After digging into sndslots.ids against charsnd.2da and csound.2da for all three games I've seen what a mess it is. The three areas don't match up 100%


The _ extension seems to be another issue because it's listed in csound.2da it should play the sound but you can't write the subs in BGEE or BG2EE.


I've attached my research...


documents.zip

Link to comment

Archived

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

×
×
  • Create New...