Difference between revisions of "AddTextReplacementData - ObjectReference"

Changed urls into wiki markdown links and added papyrus syntax format to papyrus code.
imported>Fatlenin
imported>Qazaaq
(Changed urls into wiki markdown links and added papyrus syntax format to papyrus code.)
 
(One intermediate revision by one other user not shown)
Line 25: Line 25:


== Details ==
== Details ==
There is a standard [http://www.creationkit.com/index.php?title=Text_Replacement text replacement] system that utilizes Aliases and Globals attached to Quests (and some common things like time of day spans) to do text replacement for things like books, letters, etc.. You DO NOT need to use any scripting (such as this function) in order to do basic text replacement.
There is a standard [[Text Replacement]] system that utilizes [[Alias]]es and [[Global]]s attached to [[Quest]]s (and some common things like time of day spans) to do text replacement for things like books, letters, etc.. You DO NOT need to use any scripting (such as this function) in order to do basic text replacement.


To replace text you have a token and label pair. For example <Alias.Pronoun=QuestGiver> If QuestGiver was a male that tag would be replaced with "he" if female "she." (Here "Alias" is the token and "QuestGiver" is the label.
To replace text you have a token and label pair.  
 
For example <Alias.Pronoun=QuestGiver> If QuestGiver was a male that tag would be replaced with "he" if female "she".
See: [http://www.creationkit.com/index.php?title=Text_Replacement text replacement] for general overview of how that works.
Here "Alias" is the token and "QuestGiver" is the label.


Using this script function basically allows you to create your own token label for use with a generic token.
Using this script function basically allows you to create your own token label for use with a generic token.


For instance if you wanted to display the name of an Activator named "Widget of Doom" you could make an Activator property named "MyObject" and use that in the AddTextReplacementData call, specifying a lable of "MyObjectLabel"
For instance if you wanted to display the name of an [[Activator]] named "Widget of Doom" you could make an Activator property named "MyObject" and use that in the AddTextReplacementData call, specifying a lable of "MyObjectLabel"


<source lang="papyrus">
  Activator Property MyObject auto
  Activator Property MyObject auto
   
   
Line 40: Line 41:
   myTerminal.AddTextReplacementData("MyObjectLabel", MyObject)
   myTerminal.AddTextReplacementData("MyObjectLabel", MyObject)
  EndEvent
  EndEvent
</source>


Then in that terminal's display text you can use the generic token with the specified label "MyObjectLabel":
Then in that terminal's display text you can use the generic token with the specified label "MyObjectLabel":
<source lang="papyrus">
  Control terminal for <Token.Name=MyObjectLabel>:
  Control terminal for <Token.Name=MyObjectLabel>:
</source>


Which would print to the terminal screen: "Control terminal for Widget of Doom"
Which would print to the terminal screen: "Control terminal for Widget of Doom"
Line 48: Line 52:
== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]
*[[Text Replacement]] (general text replacement info)
*[[Text Replacement]]
Anonymous user