I tried writing the value to the event log. When I straight up add a command to write |{P("Sagittarius A*")|} to the event log, it works as expected. The brackets are escaped, {P("Sagittarius A*")} appears in the log. But when I write the same thing to a variable (e.g. SCRIPT), then write that variable to the log, the brackets are swallowed.
That is normal. Both the "Text" field of the "Set a Text Value" action, and the "Value" field of the "Write a Value to the Event Log" action will parse tokens.
So, the former will strip the pipes from
|{P("Sagittarius A*")|}, setting the variable to
{P("Sagittarius A*")}, but then the latter will strip the brackets as they are not part of a valid token, resulting in
P("Sagittarius A*").
The only way I can get the pipes to be preserved is to use the "SetText" method from within an inline function (which should be equivalent to a plugin, method-wise), as that method correctly does not process tokens.
If I set a text variable using the "Set a Text Value", the pipes get stripped, as proven by retrieving its value using the "GetText" method (which does not parse tokens either).
E.G.
MessageBox.Show(VA.GetText("test"));
VA.WriteToLog(VA.GetText("test"));
will both show "{P("Sagittarius A*")}".
Only if I set the value from within the inline function
VA.SetText("test", "|{P(\"Sagittarius A*\")|}");
do the pipes remain in place.
EDDI's VoiceAttack plugin apparently uses an older version of the plugin interface, as Version 4 does not pass along any fields other than "Plugin Context".
EDIT: Just in case, I checked with a legacy plugin template using the following:
public static void VA_Invoke1(String context, ref Dictionary<string, object> state, ref Dictionary<string, Int16?> shortIntValues, ref Dictionary<string, string> textValues, ref Dictionary<string, int?> intValues, ref Dictionary<string, decimal?> decimalValues, ref Dictionary<string, Boolean?> booleanValues, ref Dictionary<string, object> extendedValues)
{
dynamic VA = state["VA_PROXY"];
VA.WriteToLog(textValues["SCRIPT"]);
}
If the variable is set using the "Set a Text Value" action, the pipes are still stripped correctly I.E. "{P("Sagittarius A*")}" is correctly written to the log).