Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik

IL-2 Sturmovik The famous combat flight simulator.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2013, 01:26 AM
Pfeil Pfeil is offline
Approved Member
 
Join Date: Jan 2012
Posts: 126
Default

This script won't work, for a number of reasons(As you've probably found out for yourself).

Have a look here, this could at least help you with selecting random files to copy.
At present, the script will copy all files from one directory to another and apply the default 999 prefix to each of them.

I would recommend against copying files. It will consume more system resources and time than simply moving them(Copying reads and subsequently writes a new file to disk, moving simply appends the MFT).

For the deletion you'd have a while loop or something similar to check if IL2 is running. When the loop ends you can move the file you used back to the Radio_Source dir.

Moving does present the problem of filenames, as you'll end up with "999_999_999_artist - song.wav" after a while. You can either remove the first 3 characters from the filename(This assumes all files in the source directory already have a prefix) or count the characters before the first underscore and replace those.

I'm also wondering about "RunWait,%GAMEPATH%\IL2_RadioRandomizer.vbs,%GAMEP ATH%,Hide".
To me this looks like it would spawn an infinite(or however many fit in memory) number of scripts all waiting on each other to finish.


As for detecting the currently playing station, that's another difficult proposal.
The console doesn't log songs or directories, and the onscreen messages aren't logged either as far as I know.
You can however use the console command "music" without any parameters to return the currently playing file. If you combine that with the log file you could rig something up.
Writing to the console is cumbersome though.


If I could I'd give you the code, but as I've stated before: While I get the logic behind it, putting it into practice is the hard part.
Reply With Quote
  #2  
Old 01-25-2013, 02:56 PM
mrburns mrburns is offline
Approved Member
 
Join Date: Mar 2008
Posts: 22
Default

I'll look into your suggestion, but this code works perfectly. Maybe its because I'm running an I7 processor, but it works fast and doesn't impact my game while its running. The runwait is used to be sure the process is finished before continuing.

You call this routine when you want the files randomized. The files that have been played can't be removed.
This procedure randomizes the source files, removes the files from the destination (except those that are locked) to avoid a buildup of unneeded files, then copies the files from the source to the destination, prepending a 3 digit number that is less than the one used the last time this procedure was called.

Since you can't do anything with the locked files until IL2 exits, its necessary to have a source that isn't locked. Otherwise you can't rename them. Hence the source folder which should never have its files removed as they are the master files.

Last edited by mrburns; 01-25-2013 at 03:09 PM.
Reply With Quote
  #3  
Old 01-25-2013, 11:31 PM
mrburns mrburns is offline
Approved Member
 
Join Date: Mar 2008
Posts: 22
Default

Here's a shorter version. It's self-contained, not relying on the vb script.
It still uses the RADIO_SOURCE folder to get the songs and COPIES them into their respective folders.

GAMEPATH = C:\Ubisoft\IL2_Current
prependCount := 999 ;for renaming radio wav files

RandomizeMusic()
{
global GAMEPATH, prependCount

Loop, %GAMEPATH%\samples\Music\Radio\*.*, 1, 0 ;non-recurse into subfolders
{
FileDelete, %A_LoopFileFullPath%\*.wav
}

Loop, %GAMEPATH%\samples\Music\Radio_Source\*.wav, , 1 ;recurse into subfolders
{
Filename = %A_LoopFileFullPath%
Random, num, 100,999
StringReplace, Name, Filename, Radio_Source, Radio
StringReplace, Filename, Name, %A_LoopFileName%, %prependCount%_%num%_%A_LoopFileName%
FileCopy, %A_LoopFileFullPath%, %Filename%
}

prependCount := prependCount - 1
}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:03 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.