Talk:Text Replacement

Active discussions

How do I associate a book with a quest? I cannot get the text replacement to show - the book is blank apart from the first few words before the text replacement. I created a quest alias (as a reference alias) for the book - ticked the 'uses stored text' (the page states 'displays text' but I think this might be an error as the only options are 'stores text' or 'uses stored text') tried to use <Alias=Player> and it will not show. I make sure the quest has started before reading the book.

Check out the note about the new checkbox introduced in 1.5 update: http://www.creationkit.com/Talk:Quest_Stages_Tab LukeH 05:11, 2 April 2012 (EDT)

Name replaced with MessageEdit

In the article it says "You can use a Message to replace the display name of anything in a quest's alias". Does this mean that it would be possible to change the name of a cell? (Or even make it appear that you have? Even if you haven't).
If so, how would I achieve this? It would make for an excellent touch in a mod that I am currently working on. Antares (talk) 12:46, 21 July 2012 (EDT)

Unfortunately I don't think so, since you can't make an Alias of a cell, only of a Location. But maybe that I'm wrong : could you assign a Location associated with a specific cell (Location data) to an alias with text replacement, and then have it's new Alias name appear when you get to that location? And if it works, would this also work with doors leading to such cell for them to display the new Location's Alias name? --HawkFest (talk) 2013-02-24T11:32:56 (EST)
I think that is the avenue I attempted to go down. I'm still pretty bad with Alias' and such so I haven't given it my best shot yet. If I find something out I'll definitely be letting people know. Thanks for the tip though, it sounds good in theory. Antares (talk) 2013-02-24T17:31:32 (EST)

Week DaysEdit

While I have been working with this tag it would seem to be four days ahead as when it is used with GameDaysPassed all information is correct except the weekday, but it can be easily fixed by simply creating a new GlobalVariable and making sure you offset GameDaysPassed by - 4 Bot Owned (talk) 2013-05-03T09:57:39 (EDT)

Findings from reverse-engineeringEdit

There are multiple places in the game that accept tokens of the following forms:

  • <Tag>
  • <Tag.Subtag>
  • <Tag.Subtag=Parameter>
  • <Tag.SubtagCap>
  • <Tag.SubtagCap=Parameter>
  • <Tag=Parameter>

The game has a templated function with a signature like the following:

template<typename Handler>
void DoTextReplacement(BSString& string, Handler& handler);

That function modifies the given string using the given handler, and it always works the same way: it searches for any text contained in symmetrical angle brackets, and divides it apart at the first found period and the first found equal sign. The tag, subtag, and parameter are then passed to a member function on the handler, whose return value is appended to the destination string (with capitalization of the first appended character performed afterward, if appropriate). This is done in a loop until all tags have been replaced or skipped. (The templated function doesn't check whether these parameters are properly ordered, so theoretically, you could also do <Tag=Parameter.SubtagCap>.)

This system is used not only for quest-related text, but also for magic effect descriptions and in other places I have yet to identify. Specifically:

  • There exists a handler type that just deletes all tags from a string.
  • There exists a handler type that recognizes the following tags, resolving them relative to an Actor:
    • <BribeAmount>: The actor's bribe amount
    • <CrimeGold>: The player's current bounty ("crime gold") with the actor's crime faction
    • <CrimeGoldViolent>: The portion of the player's current bounty ("crime gold") with the actor's crime faction that resulted from violent crimes
    • <CrimeGoldNonviolent>: The portion of the player's current bounty ("crime gold") with the actor's crime faction that resulted from non-violent crimes

Each handler has its own behaviors for invalid tags. Most handlers return a null string pointer. The handlers related to magic effects wrap their return values with "start" and "end" text (configurable at the engine level; Scaleform uses simplified HTML and we know this text gets bolded, so it's probably always <b> and </b>), are careful to return empty strings (no wrapping) when predefined tags are misused, and will react to unrecognized tags by returning the wrapped tag name (but not the subtag or parameter). The handlers for quest-related text (other than <BaseName>) return "[...]".

DavidJCobb (talk) 21:42, 15 October 2024 (EDT)

Return to "Text Replacement" page.