Talk:Subtitles (Portal 2)

From Valve Developer Community
Jump to: navigation, search


I wanted GLaDOS to speak when I pressed a button

I have my captions inside a file called closecaption_mymod_English.txt which is in the format:

	Language "English"
		GLaDOS.ramble1	"Sorry about the mess. I've really let the place go since you killed me."
		GLaDOS.ramble2	"By the way, thanks for that."

I open up the cmd prompt and put in:

"U:/Program Files/Steam/steamapps/common/Portal 2/bin/captioncompiler.exe" -v "closecaption_mymod_English.txt"

In Hammer I create an ambient_generic which points towards my custom GLaDOS sound and named it: glados_ramble1. I also add a point_servercommand and name it @servercommand. Inside a newly created logic_auto I put:

My Output Target Target Input Parameter
OnMapSpawn @servercommand Command cc_lang mymod_English

I create a prop_button and add another output:

My Output Target Target Input Parameter
OnPressed @servercommand Command cc_emit GLaDOS.ramble1

Also in the prop_button I add another output to activate the sound:

My Output Target Target Input Parameter
OnPressed glados_ramble1 PlaySound

Tada! The captions appear with the sound.

--Chickenmobile 00:20, 1 March 2012 (PST)

No .DAT file

It doesn't create the .DAT file. I have the captioncompiler.exe in my Steam\SteamApps\Portal 2\bin folder like the article said. I created a text file called: closecaption_aperture_ai and within it:

	Language	"english"
		portal.00_part1_entry-1	"<clr:219,112,147><I>Hello and, again, welcome to the Aperture Science computer-aided enrichment center."

I have saved it with notepad++ in the required format and dragged it over to the captioncompiler.exe. It did something in a fraction of a second, closed itself then nothing happened. I have also tried to create the .bat file but I'm not the best in programming. This is what it looks like:

"D:\Steam\SteamApps\common\Portal 2\bin\captioncompiler.exe" %1 -Portal 2 "D:\Steam\SteamApps\common\Portal 2\portal2\gameinfo.txt"

FIRE-Buzzard (talk) 06:27, 31 August 2018 (UTC)

Your captions have to be split by language. Rename it to closecaption_english.txt.
Also in your bat, change -Portal 2 to -game.
The second file path is off. It should go to the folder containing the gameinfo.txt instead of the file itself, so for Portal 2 you would want "C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2" (of course change the C:\Program Files (x86) for whatever your system uses). If you're making a mod, put the path to the folder for that mod. Pinsplash (talk) 19:00, 30 August 2018 (UTC)
I followed your instructions and the CMD has changed but it still didn't generate the .DAT file. The CMD:
--- Close Caption File compiler ---
gamedir[ D:\Steam\SteamApps\common\Portal 2\portal2\ ]
infile[ resource\closecaption_english.txt ]
outfile[ resource\closecaption_english.dat ]
DLC present, but no -d paramater specified!
(Use -d 0 for base game, -d 1 for DLC1, ect.)
If I add -d 0 or -d 1 to the end of the first line in the .bat the CMD extends it's previous message:
--- Close Caption File compiler ---
gamedir[ D:\Steam\SteamApps\common\Portal 2\portal2\ ]
infile[ resource\closecaption_english.txt ]
outfile[ D:\Steam\SteamAppS\common\Portal 2\portal2\resource\d:\steam\steamAppS\common\portal 2\portal2\resource\closecaption_english.dat ]
Found 1 strings in 'resource\closecaption_english.txt'
Longest string 'portal.00_part1_entry_1' = (208) bytes average(8192.000)
I didn't wrote the path in outfile twice. Thats waht the CMD wrote. FIRE-Buzzard (talk) 06:27, 31 August 2018 (UTC)
The second output there looks pretty normal, except for the outfile part. Show me your updated bat file. Pinsplash (talk) 06:46, 31 August 2018 (UTC)
The bat file:
"D:\Steam\SteamApps\common\Portal 2\bin\captioncompiler.exe" %1 -game "D:\Steam\SteamApps\common\Portal 2\portal2" -d 0

FIRE-Buzzard (talk) 07:04, 31 August 2018 (UTC)

Odd. Try changing the second filepath to just "resource\closecaption_english.txt". Pinsplash (talk) 08:03, 31 August 2018 (UTC)
Still nothing. Now it want's me to run a vconfig to specify which game you're working on or add -game <path> to find the gameinfo.txt FIRE-Buzzard (talk) 09:03, 31 August 2018 (UTC)
Well, the only other thing that seems weird to me is your capitalization of the steamapps folder. Mine is steamapps, not SteamApps. Change your bat file back to this:
"D:\Steam\steamapps\common\Portal 2\bin\captioncompiler.exe" %1 -game "D:\Steam\steamapps\common\Portal 2\portal2" -d 0
Pinsplash (talk) 15:52, 31 August 2018 (UTC)
Still the same outfile path. Only the first part's capital letters changed. FIRE-Buzzard (talk) 21:25, 31 August 2018 (UTC)
I dragged the .txt and .bat out to my desktop and tried it again. Now this is the outfile:
D:\Steam\steamapps\common\portal 2\portal2\resource\c:\users\(username)\desktop\closecaption_english.dat
Unable to add localization file 'resource\c:\users\(username)\desktop\closecaption_english.txt
FIRE-Buzzard (talk) 21:30, 31 August 2018 (UTC)
Are you sure your txt is saved in UCS-2 Little Endian? Pinsplash (talk) 21:38, 31 August 2018 (UTC)
I'm sure but I have re-wrote it to make sure this is not the problem. Still nothing FIRE-Buzzard (talk) 23:09, 31 August 2018 (UTC)
I really don't see what could be wrong... Try cutting out the middleman and just drag your txt directly onto captioncompiler.exe instead. Pinsplash (talk) 23:52, 31 August 2018 (UTC)
Didn't work either. Does it work on your side? FIRE-Buzzard (talk) 09:08, 1 September 2018 (UTC)
Yeah, I've never had any issue like this. Have you tried just this:
"D:\Steam\steamapps\common\Portal 2\bin\captioncompiler.exe" %1
Pinsplash (talk) 15:48, 1 September 2018 (UTC)
Just tried it, (it required the -d 0) but still nothing. Maybe there's something with the captioncompiler.exe. FIRE-Buzzard (talk) 22:28, 1 September 2018 (UTC)
Yeah, I'd try verifying your files through Steam. Pinsplash (talk) 22:31, 1 September 2018 (UTC)
By the way, there was 2 original closecaption_english files. The .txt and the .bat. I moved them to a folder on my desktop. Is that a problem? Nothing changed FIRE-Buzzard (talk) 22:42, 1 September 2018 (UTC)
ZecMaqaw figured out something. Try changing the %1 to %~nx1. Pinsplash (talk) 02:10, 2 September 2018 (UTC)
It WORKS!!! Huuuuge thanks. Here's my final .bat file:
"D:\Steam\steamapps\common\Portal 2\bin\captioncompiler.exe" %~nx1 -d 0
FIRE-Buzzard (talk) 09:10, 2 September 2018 (UTC)