Difference between revisions of "Talk:Text Replacement"
imported>Bot Owned |
DavidJCobb (talk | contribs) (→Findings from reverse-engineering: new section) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 8: | Line 8: | ||
== Week Days == | == Week Days == | ||
While I have been working with this tag it would seem to be | 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 | ||
[[User:Bot Owned|Bot Owned]] ([[User talk:Bot Owned|talk]]) 2013-05-03T09:57:39 (EDT) | [[User:Bot Owned|Bot Owned]] ([[User talk:Bot Owned|talk]]) 2013-05-03T09:57:39 (EDT) | ||
== Findings from reverse-engineering == | |||
There are multiple places in the game that accept tokens of the following forms: | |||
* <code><''Tag''></code> | |||
* <code><''Tag''.''Subtag''></code> | |||
* <code><''Tag''.''Subtag''=''Parameter''></code> | |||
* <code><''Tag''.''Subtag''Cap></code> | |||
* <code><''Tag''.''Subtag''Cap=''Parameter''></code> | |||
* <code><''Tag''=''Parameter''></code> | |||
The game has a templated function with a signature like the following: | |||
<pre lang="c++"> | |||
template<typename Handler> | |||
void DoTextReplacement(BSString& string, Handler& handler); | |||
</pre> | |||
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 <code>handler</code>, 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 <code><''Tag''=''Parameter''.''Subtag''Cap></code>.) | |||
This system is used not only for quest-related text, but also for [[Magic Effect#Magic Item Description|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: | |||
** <code><BribeAmount></code>: The actor's bribe amount | |||
** <code><CrimeGold></code>: The player's current bounty ("crime gold") with the actor's crime faction | |||
** <code><CrimeGoldViolent></code>: The portion of the player's current bounty ("crime gold") with the actor's crime faction that resulted from violent crimes | |||
** <code><CrimeGoldNonviolent></code>: 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 <code><b></code> and <code></b></code>), 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 <code><BaseName></code>) return "[...]". | |||
[[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 21:42, 15 October 2024 (EDT) |
Latest revision as of 20:42, 15 October 2024
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 Message[edit source]
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)
Week Days[edit source]
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-engineering[edit source]
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)