TTLG|Jukebox|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 14 of 14

Thread: Tutorial: Conversation Subtitles using OnscreenText

  1. #1
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum

    Tutorial: Conversation Subtitles using OnscreenText

    Tutorial: Conversation Subtitles

    This tutorial will show you how to put subtitles on the screen during conversations, and have the text tightly synchronized to the audio. Also things like coloured text, tailoring the onscreen time and splitting a long line into several texts will be covered. This tutorial utilizes Telliamed's OnscreenText script, which is available in tnhScript.

    One main particular benefit is that this allows you to have the .str files for your subtitles translated, and players get localized subtitles for conversations. As long as you keep the files named the same and in language subfolders, it will work with no other changes, just as book texts do. This adds a lot of value since in most FMs, the texts and objectives are translated but the voice acting is usually only in English.

    Step 1 - Creating the .str file
    You need to create the .str file for your conversation's subtitles using a text editor; I use Notepad++. In most cases, place one line per page. However, each page will be shown on screen in its entirety, so longer lines may need to be broken up to avoid having a huge block of text on screen at one time. You can do this even if the long line is a single WAV file, using a technique I'll outline in the Advanced section later.

    First of all, the page_n descriptor is used just as with any other book text. You may want to prepend the speaker's name in front of the line, to make it clear to the player who is speaking, like so:
    page_0: "Lord Bumbleson:  Cookie? COOKIE! Where is my dinner?"
    You need not name the speaker, it could simply be "A guard" or "A Hammerite priest", for example. You may also choose to put quotes around the spoken words, which can be done using either single quotation marks, or a backslash before a double-quote:
    page_0: "Lord Bumbleson:  'Cookie? COOKIE! Where is my dinner?'"
    page_0: "Lord Bumbleson:  \"Cookie? COOKIE! Where is my dinner?\""
    Next, if you wish to make the text coloured (perhaps using the same colour for a given character throughout the mission), use the page_n_color descriptor. The value, in quotes, is in the standard HTML format #RRGGBB, and simple HTML colors like "red" or "blue" may also work, I've not tried.
    page_0_color: "#3050DD"
    If you're unsure how to determine the #RRGGBB code for a given colour, look in your graphics editor at the colour selection tool, or use an online resource like to choose your colours.

    The script will automatically set the duration to leave the text on screen based on its length, but sometimes you may need it to be shorter or longer. You can manually set a specific duration by using the page_n_time descriptor, giving a time in milliseconds. So to make Lord B's line remain on screen for 10 seconds:
    page_0_time: "10000"
    In most cases, however, I've found I need not set the time manually. I recommend that you go without any time values initially until you've tested the full working conversation in game and then only add times as needed.

    So altogether, the first block in my .str file, for Lord Bumbleson's line, might look like this:
    page_0: "Lord Bumbleson:  'Cookie? COOKIE! Where is my dinner?'"
    page_0_color: "#3050DD"
    page_0_time: "10000"
    Continue doing this for every line in your conversation. Be sure the .str file is in your \books\English folder (or whatever your language is).

    Step 2: Dromed work

    First, of course you need to load tnhScript if you've not already done so in your mission. I like to create an archetype under TrapTrig called SubtitleTrap, and add to it
    Scripts: OnscreenText
    Editor > Design Note: page=0;
    but you don't have to. It's fine to just create a TrapTrig instance and add those properties to the concrete object.
    Then, you only need to set the Book > Text property to the name of your subtitles .str file.

    Next, you need to make a button and ControlDevice-link it to the subtitle trap. Go in game and frob it, and you should see the first line on screen. Successive frobs cycle through all the lines, and eventually wrap back to the first line and start over. Once you confirm the button works, you need to name it since you'll be referring to it in the conversation steps; for my example I'll just call it "BtnSubsC1701" since it's for conversation c1701. Then, you should move it outside of any roombrush so the player won't hear it clicking whenever an AI frobs it. I usually embed it in a wall nearby so I can find it if I need to.

    All you need to do now is create your conversation, hook up the actors with AIConversationActor links (set the data to actor number), and begin adding steps - find a basic tutorial on conversations if you don't know how to do that. I generally use one step per line of the conversation, and the first action in any step which will have an actor speaking a line should generally be to frob the button. In other words, the actor about to speak should frob the button just prior to using the Play motion/sound action to say the line and perform motions.

    So Lord Bumbleson's actions in the first step might be:

    First, he frobs the button to put the text on screen, then he plays the line and a motion, followed by a second motion. That's just an example, you will of course use different values and motions. Continue adding additional steps to the conversation in this way, generally having one actor frob the button and then play one line and play one or more motions per step of the conversation.

    Step 3: Testing

    Go into game mode and trigger the conversation (rigging a test button linked to it is the simplest way). You should see each subtitle on screen as the actor says the line. If you notice any lines that should be onscreen longer, go into the .str file and add the _time descriptor and play with its value until the duration is what you like.

    By always frobbing the button once just before performing a Play motion/sound action, the text stays in synch with the audio.

    Advanced Usage: Splitting lines

    Suppose Cookie's excuse-ridden reply to Lord B. is very long-winded, and the text would be best split over two or more onscreen lines. This is easily done without any further changes to Dromed, or editing of the WAV file into multiple parts. In fact, this can be adjusted only through manipulating the .str file and nothing else.

    Let's say that Cookie's response, Line 2 of the conversation, is "But your Lordship, I cannot complete thy meal without carrots, and the market stall had no carrots today. I have sent Armand to Auldale on a carrot quest, telling him not to return without carrots. When he returns with said carrots, I shall present thee with a meal fit for a king... or at the very least, fit for a pompous lord." That's quite too much to show on screen at once, so to split it you only need to make it multiple pages in the .str file, like so:
    page_1: "Cookie:  But your Lordship, I cannot complete thy meal without carrots, and the market stall had no carrots today."
    page_1_color: "#FFFF40"
    page_1_auto: "6"
    page_2: "Cookie:  I have sent Armand to Auldale on a carrot quest, telling him not to return without carrots."
    page_2_color: "#FFFF40"
    page_2_auto: "4"
    page_3: "Cookie:  When he returns with said carrots, I shall present thee with a meal fit for a king... or at the very least, fit for a pompous lord."
    page_3_color: "#FFFF40"
    Note the usage of the page_n_auto descriptor on the first two lines. This tells the script to automatically advance to the next page after that number of seconds (note seconds are used here, whereas milliseconds are used for the "time" parameter... I'm not sure why Telliamed did that). So, the actor is still only frobbing the button once at the beginning of starting this long line, but all three parts of the line will be displayed in succession. Naturally, you will need to adjust the "_auto" values to fit the lengths of the audio that corresponds to each bit. Note also that you should NOT put a page_n_auto on the last page; you want the next line (presumably spoken by another actor) not to be shown until its actor frobs the button again.

  2. #2
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements

    Thank you! Very easy to understand.

  3. #3
    Thanks for this. I've saved it for future reference.

  4. #4
    d. 30.4.16 Always remembered
    Registered: Apr 2002
    Location: in our hearts
    Many thanks!

  5. #5
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    Welcome. I will be adding to it soon as we've also found that OnscreenText is useful for collecting many short texts, such as all the book titles in your mission, in a single .str file.

  6. #6
    Registered: Mar 2012
    Location: Moscow, Russia
    I'm going to add subtitles to my new missions, since there will be no Russian voice acting, so there will only be one zip.
    Is this compatible with the subtitle background that NewDark adds?

  7. #7
    Registered: Dec 2004
    Location: Germany
    The subtitles made with this old script method and the NewDark based subtitle function are two completely different things. AFAIK, each of these subtitle functions does not influence the other one in any way.

  8. #8
    Registered: Mar 2012
    Location: Moscow, Russia
    I didn't find a tutorial on how to make NewDark subtitles like in The Black Parade. I would like to compare the pros and cons of both methods.

  9. #9
    Registered: Apr 2011
    the newdark docs contain subtitles.txt describing the subtitle files and settings, and subtitles-sample.sub containing detailed examples with commentary (which is instructive, but a lot to take in all at once).

    in addition, you can look at the subtitles folder in any mission that comes with subtitles, such as The Black Parade, or my subtitles for Making a Profit, or indeed the english subtitles mods for the original missions (which i think can be installed by TFix and T2Fix — if not, they can be found here for thief gold, and here for thief 2).

  10. #10
    Registered: Mar 2012
    Location: Moscow, Russia
    I figured out how to make subs, let's assume I already have this. How to add subs to the Conversation interface? Based on this example, where should I add ke1m0101?

    	TYPE	"convo"
    	DESCR	"Keeper Instructor"
    	SUB	"ke1m0101" { TEXT "Come on son, proceed with your training. If you wish to hear the instructions again, tell me." }
    	SUB	"ke1m0102" { TEXT "You aren't playing by the rules, young one." }
    	SUB	"ke1m0103" { TEXT "Welcome, young Garrett." }
    	SUB	"ke1m0104" { TEXT "In the nearby rooms I will instruct you in the various skills you will need to survive. Please stay in the entrance area to each room while I explain the room's purpose. When you are ready to begin your lessons, proceed down this hallway to the first room." }

  11. #11
    Registered: Apr 2011
    NewDark subtitles are automatically shown (when enable_subtitles is turned on in cam_ext.cfg or user.cfg) when the corresponding sound file is played, whether by an AmbientHacked or a conversation Play Sound/Motion step (or any other means).

    if you have a suitable schema defined for the "ke1m0101" sound, you would just use a Play Sound/Motion step in the Conversation as usual, and NewDark handles finding the right subtitle text and displaying it.
    Last edited by vfig; 24th Jan 2024 at 13:35.

  12. #12
    Registered: Jan 2006
    Location: On the tip of your tongue.
    You will of course need to enable subtitles to see them.

  13. #13
    Registered: Mar 2012
    Location: Moscow, Russia
    So it's easier than Yandros' method, but I'll check both.

    There is a problem with the inline font. When I made Raven's Nest, I splited the text into lines as described here so that it would look neat on screen.
    Now I have a big monitor, and that text is tiny. I doubled the size of the font, but now the lines are broken and in some places takes up almost the entire screen. Thus, for some players the text will look bad.

    As for NewDark subs, there is also a problem here. In The Black Parade displays absolutely all subs or none at all. Exceptions don't work. More precisely, they do not work in this fm, but in the original game everything was fine. The guards are constantly muttering something, although I added to User.cfg this lines:
    subtitles_hide_types bark+urgent+fx
    When I played I had to disable subtitles until important conversations happened and enable them again.

  14. #14
    Registered: Apr 2011
    Quote Originally Posted by Soul Tear View Post
    As for NewDark subs, there is also a problem here. In The Black Parade displays absolutely all subs or none at all. Exceptions don't work.
    this is a problem with The Black Parade itself: unfortunately, all of its custom npc subtitles (in TBP_*.sub) are labelled with TYPE "convo", instead of being alerts being assigned to "urgent" and mutterings/banter being assigned to "bark" as should have been done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts