Custom demos record

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
Gzdoomer

Custom demos record

Post by Gzdoomer »

Hello!
Im looking for command that automatically record my games with date and pwads. I was trying

Code: Select all

-record %DATE%_%TIME%_%WAD%.lmp
but it wont work. Plz help. Thnx
User avatar
Rachael
Developer
Developer
Posts: 3646
Joined: Sat May 13, 2006 10:30

Re: Custom demos record

Post by Rachael »

Of course it won't work. This is what %date% returns on U.S. versions of Windows:

Code: Select all

Tue 03/15/2016
First off, you have a whitespace at the very start, which to GZDoom indicates there's another parameter incoming. Then you have the / slashes, which indicate folders, so that's obviously not going to work, either.

%time% is even more of a nightmare.

Code: Select all

 2:11:06.90
That has : colons in it - and that's a reserved character (reserved to indicate a DOS device, in Windows) - so that even more will not work.

And %wad% will always come up blank. You can use %1 as a placeholder, instead though, with some limitations.

These parameters are not processed by GZDoom - they are processed by Windows, which is completely indifferent to what GZDoom thinks the parameters should look like.

In order to process these dynamic variables successfully, you must use variable extensions, which was introduced a long time ago in Windows NT. This is something you can try:

gzdoom-demo.bat

Code: Select all

gzdoom -file %1 -record "%date:~10,4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%_%~n1.lmp"
Save this to a batch file, and you can drag-n-drop your wad files onto the batch file instead of GZDoom. This is how it works:

%1 records the first parameter of the batch file, which with Windows, will be the first drag-n-drop target.
%date:~10,4% takes %date%, and extracts 4 digits starting from the 11th digit. (Year, on U.S. systems)
%date:~4,2% does the same thing, except 2 digits starting at the 5th digit. (Month, on U.S. systems)
%date:~7,2% again does the same thing, 2 digits starting at the 8th digit. (Day, on U.S. systems)

%time:~0,2% extracts the hour from %time% - same as the way the %date% expansion worked. U.S. format
%time:~3,2% extracts the minute
%time:~6,2% extracts the seconds

%~n1 removes the quotes from %1 and strips it away of everything except the base filename. Not even the extension is added. So "C:\Program Files\GZDoom\bigfancy.wad" would be changed to just plain bigfancy

Lastly, the entire filename is encased by quotation marks - allowing whitespaces to occur (which will occur with all early morning instances of the %time% command).

So, the command, according to Windows, becomes this after processing: (You do not type this, this is just an example)

Code: Select all

gzdoom -file "C:\Users\Rachael\Desktop\Wads\fancywad.wad" -record "20160315_ 21106_fancywad.lmp"
GZDoom can manage this a whole lot easier, and the -record points to a valid filename.

Hope this helps, somewhat.

EDIT:

Your IP indicates you are from Europe, so the %date% and %time% will have to be adjusted to your specific locale. To see what %date% and %time% look like in your operating system, hit Windows+R (to open the Run prompt), type "cmd" and hit enter. Then type the following:

Code: Select all

echo %date%
echo %time%
Hit enter after each command. Count the number of characters and you will have to figure out how to extract the right ones. If you want, you can post a screenshot of your command prompt window and I can help you figure that out. Please upload them as an attachment to your post if you can, if not, use http://imgur.com/ - because any other image host just plain sucks and I can't read images from any of them. (sorry)
Locked

Return to “GZDoom”