Text Replacement

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
This article has been flagged as incomplete.
Please help improve the wiki by learning how to contribute.

The Text Replacement game system parses value tokens and formatting tags. This is used on a several forms like Books and Terminals. Tag information was copied from the UESP Skyrim wiki. Some tags may not apply to Fallout 4.

Tags[edit | edit source]

<Alias=AliasName>

  • This tag is replaced with the full name of the reference filling the alias AliasName.
  • In order to use this, you need to mark the specified alias as "Stores Text" (this indicates to the quest that the alias name needs to be saved onto the quest instance data).
  • If the resulting text is '[...]', then that means the alias wasn't filled.
  • This tag will show the base form name even if the name has been changed via text replacement. see <Alias.CurrentName=AliasName>

<Alias.CurrentName=AliasName>

  • This tag will show the current name applied to the ref via text replacement or the base form name if no text replacement has been applied.

<Alias.Subtag=AliasName>

  • Various subTag exists to give you additional parsing awesomeness, for example: <Alias.Race=Bob> would print Bob's race name.
  • <Alias.ShortName=AliasName> -- the short name if it exists (otherwise just uses the normal full name).
  • <Alias.Race=AliasName> -- the race name.
  • <Alias.Pronoun=AliasName> -- pronoun ("he" or "she")
    • <Alias.PronounObj=AliasName> -- pronoun object ("him" or "her")
    • <Alias.PronounPos=AliasName> -- pronoun possessive ("his" or "hers")
    • <Alias.PronounPosObj=AliasName> -- pronoun possessive ("his" or "her")
    • <Alias.PronounRef=AliasName> -- pronoun reflexive("himself" or "herself")
    • <Alias.PronounInt=AliasName> -- pronoun intensive("himself" or "herself")
      • NOTE: in English reflexive and intensive pronouns are the same, I'm not sure they are in all languages though, so be careful. Examples:
        • Intensive: "Bob himself was the one that did it." (emphasizes the noun Bob)
        • Reflexive: "He saw himself in the mirror." (subject and object refers to the same person)

<Alias.SubtagCap=AliasName>

  • Adding "Cap" to the end of any subtag will cause it to be capitalized:
    • "<Alias=Bob> ate <Alias.PronounPos=Bob> sandwich. <Alias.PronounCap=Bob> was happy." becomes "Bob ate his sandwich. He was happy."

Automatic <Alias=Player> "text parsing alias"

  • You can use <Alias=Player> and <Alias.Pronoun=Player> etc. WITHOUT needing to put the player in an alias.
  • Note that in order for this to work inside a Book or Terminal, the ref needs to have an active quest reference pointing to it (e.g. from the Quest Aliases tab of a quest of your choice).

<Global=GlobalName>

  • This tag is replaced with the value in global GlobalName at the start of the quest. Float globals are displayed to two decimal places.
  • In order to use this, you need to add the global to the list on the Quest Data tab.
  • The current value of these globals will be saved to the current quest instance when the quest starts. This will be updated each time the quest starts for repeating quests.
  • If these values change during the quest, and you want the current quest instance to know about this change, use the function UpdateCurrentInstanceGlobal_-_Quest.
  • Subtags for Global.
    • <Global.ValueInt=GlobalName> -- Displays value as a whole number. (truncate the value)
    • <Global.Hour12=GlobalName> -- Global based on GameDaysPassed parsed as hours on a 12-Hour scale.
    • <Global.Minutes=GlobalName> -- Global based on GameDaysPassed parsed as minutes.
    • <Global.Month=GlobalName> -- Global based on GameDaysPassed parsed as the current month expressed as a number
    • <Global.MonthWord=GlobalName> -- Global based on GameDaysPassed parsed as the current month expressed as a word. This may be Skyrim only.
    • <Global.Day=GlobalName> -- Global based on GameDaysPassed parsed as the current day.
    • <Global.WeekDay=GlobalName> -- Global based on GameDaysPassed parsed as the current weekday. This may be Skyrim only.
    • <Global.Year=GlobalName> -- Global based on GameDaysPassed parsed as the current year.
    • <Global.TimeSpan=GlobalName> -- Global based on GameDaysPassed parsed as the current span of time (e.g., Afternoon, Morning, Evening)
  • There's a special subtag for timers
    • <Global.Time=GlobalName> -- Global value parsed as "X Hours" for values greater than 1 or "X Minutes" for values less than 1.

<BaseName>

  • This tag is replaced with the original full name of the object. This only works when changing a ref alias's display text.


If a tag fails to parse for any reason (invalid format, invalid param, etc) the unparsed tag is displayed in the text instead.

Example[edit | edit source]

For example, myQuest has 2 globals defined on the quest data tab (myWidgetCount and myWidgetTotal) and an objective:

"Find 20 widgets for Bob (<Global=myWidgetCount>/<Global=myWidgetTotal>)"

This will be displayed as:

"Find 20 widgets for Bob (0/20)"

Anytime myWidgetCount changes, a script needs to call:

myQuest.UpdateCurrentInstanceGlobal(myWidgetCount)

And then redisplay the objective. (The helper function ModObjectiveGlobal can handle all of this in a single function call.)

Where Used[edit | edit source]

Text replacement tags can be used in the following text fields:

  • Quest stage Log Entry
  • Quest objective Display Text
  • Topic prompts (but not Topic Info)
  • Messages - Title and Message Text but not menu items.
  • Book - Body text.
  • Terminal - Body and menu text and menu items.

For Messages Books and Terminals, the base objects must be associated with a specific quest in order to use text replacement. For books and terminals, you must add the reference to a quest alias of a running quest and the alias is flagged "Uses Stored Text". Text replacement is unable to be used in terminals viewed with the pipboy as the pipboy is in inventory and does not have a valid reference ID that can be placed in alias.

Name replaced with Message[edit | edit source]

You can use a Message to replace the display name of anything in a quest's alias. Select a message on the "Display Name" dropdown on the Alias window. The Title of the Message is used instead of the alias's normal name. The Message can use text replacement (see above), including the base name of the aliased object. This is how you would rename a weapon to "Bob's 10mm Pistol" for example.

Tokens[edit | edit source]

Token labels can be added to a form to be replaced via script at run time.

Markup[edit | edit source]

Some text fields support a variety of Markup tags used with formatting.

Example[edit | edit source]

<!--This is the example for text markup-->
<font face='$HandwrittenFont' size='35'>Hello World!</font>
<b><i><u>This is bold, italic, and underlined.</u></i></b>
<BR>These are some colors I like.
<ul>
<li>Black</li>
<li>White</li>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ul></nowiki>
[pagebreak]
<!--A new page has starts here-->
<p align='center'>My center aligned text.
<p align='left'>My left aligned text.

Syntax[edit | edit source]

  • Comment Tag
    • Tag: <!--Comment text-->
    • Description: Comments tell the renderer not display the text wrapped within the tags while still retaining the text in the editor.
  • Bold Tag
    • Tag: <b></b>
    • Description: Text surrounded by bold tags will be bolded.
  • Italic Tag
    • Tag: <i></i>
    • Description: Text surrounded by italics tags will be italicized.
  • Underline Tag
    • Tag: <u></u>
    • Description: Text surrounded by underline tags will be underlined.
  • List Tag
    • Tag: <ul><li>ITEM HERE</li></ul>
    • Description: Creates list items with an empty square for the icon. Each list item is indented and separated by an empty line.
    • Example: <ul><li>Red</li><li>Green</li><li>Blue</li></ul>
  • Line-Break Tag
    • Tag: <br>
    • Description: Breaks the text to the next line. Strictly speaking, this tag isn't necessary. You can just as easily add blank lines to the book text.
  • Page-Break
    • Tag: [pagebreak]
    • Description: Breaks to the next page. Must be on its own line. Text automatically breaks to the next page once it reaches the end.
    • Note: images do not, so if you notice your images running off the edge of the page, manually place a page-break or reduce the size of your image.
  • Paragraph Tag
    • Tag: <p>
    • Description: Aligns and delineates a block of text as a paragraph.
      • Alignment
        • Tag: <p align='center'>
        • Description: Aligns the surrounded text. Valid values are 'left', 'right', 'justify', 'center'.
        • Note: If you want to place an image within some text so that it wraps around it, the text containing the image needs to be within paragraph tags.
  • Font Tags
    • Tag: <font>
    • Description: Changes the font attributes of the surrounded text.
      • Color
        • Tag: <font color='#FFFFFF'></font>
        • Description: Changes the font's color.
      • Face
        • Tag: <font face='$HandwrittenFont'></font>
        • Description: Changes the typeface of the font. See the fonts section for valid typeface names.
      • Point Size
        • Tag: <font size='20'></font>
        • Description: Changes the font size. See below for the line lengths you can accommodate using different font sizes.
      • Alpha
        • Tag: <font alpha='#FF'></font>
        • Description: Changes the font's transparency. Two-digit hexadecimal values from '#00' (fully transparent) through '#FF' (fully opaque) are supported.
  • Image tags
    • Tag: <img>
    • Description: Places an image on the page.
      • Source Filename
        • Tag: <img src='img://example.dds'>
        • Description: This attribute specifies the filename of the image you want to show up. You need to use the texture path to an image.
        • Note: Make sure the filename begins with img://.
      • Height and Width
        • Tag: <img src='example.dds' height='40' width='40'>
        • Description: Sets the height and width of the image in pixels.
      • Illuminated Letters
        • Tag: <img src='img://Textures/Interface/Books/Illuminated_Letters/X_letter.png'>
        • Description: Used for adding special illuminated letters at the beginning of books. (Replace the "X" with any letter or number.)

Fonts[edit | edit source]

The fonts displayed in game are stored in a Flash File font library. These font libraries are shared between menus during runtime. The current font configuration can be found in Fallout 4\Data\Interface\FontConfig.txt

  • Library:Interface\fonts_en.swf
    Example of the main Fallout 4 font
    • Font Class: $MAIN_Font
    • Font Family: Roboto Condensed
    • Font Style: Normal
  • Library:Interface\fonts_en.swf
    Example of the main Fallout 4 font, bolded
    • Font Class: $MAIN_Font_Bold
    • Font Family: Roboto Condensed
    • Font Style: Bold
  • Library:Interface\fonts_en.swf
    Example of the handwritten font in Fallout 4
    • Font Class: $HandwrittenFont
    • Font Family: Handwritten_Institute
    • Font Style: Normal
  • Library:Interface\fonts_en.swf
    Example of the Brody font in Fallout 4
    • Font Class: $BRODY
    • Font Family: "Brody"
    • Font Style: Bold
  • Library:Interface\fonts_en.swf
    Example of the terminal font in Fallout 4
    • Font Class: $Terminal_Font
    • Font Family: Share-TechMono
    • Font Style: Normal
  • Library:Interface\fonts_en.swf
    • Font Class: $Controller_Buttons
    • Font Family: Controller Buttons
    • Font Style: Normal
  • Library:Interface\fonts_en.swf
    • Font Class: $Controller_Buttons_inverted
    • Font Family: Controller Buttons inverted
    • Font Style: Normal
  • Library:Interface\fonts_en.swf
    • Font Class: $CClub_Font
    • Font Family: Eurostile LT Std Roman
    • Font Style: None
  • Library:Interface\fonts_en.swf
    • Font Class: $CClub_Font_Bold
    • Font Family: Eurostile Cyr Std Bold
    • Font Style: None
  • Library:Interface\fonts_console.swf
    Example of the console font in Fallout 4
    • Font Class: $ConsoleFont
    • Font Family: Arial
    • Font Style: Normal
  • Library:Interface\fonts_console.swf
    Example of the console debug font in Fallout 4
    • Font Class: $DebugTextFont
    • Font Family: Consolas
    • Font Style: Normal

See Also[edit | edit source]