I'm trying to write a script to highlight a column of values (all separate text fields) based on a control value.
I have two materials, WHITE and GOLD.
Obviously, you can enter "{m:WHITE}SOMETHING" or "{m:GOLD}SOMETHING" in the take item data, and it's all good.
I need the scene to decide whether or not to highlight something in gold. In the project I am giving a link for, the first scene allows us to write an OnTextSet script very simply, like this:
if Text = "GOLD" then
Text = "{m:GOLD}" & Text
else
Text = "{m:WHITE}" & Text
end if
And it works; so that was my first test - you can actually use the Macro from scripting, and not just in take item data.
So now the goal is to highlight an entire column of values in gold... but it did not work. I've reduced the problem to it's simplest form as the second scene in the project I've given a link to. All it tries to do is set the value of [I]another text object.[/I] It does not work. So now the OnSetText script is applied to a text field called "ControlText," and based on it's text value, it's trying to set the material on Text1:
dim obj as XpTextObject
if Scene.GetObjectByName("Text1", obj) then
if Text = "GOLD" then
obj.Text = "{m:GOLD}" & obj.Text
else
obj.Text = "{m:WHITE}" & obj.Text
end if
end if
TL;DR: you can set the material macro in scripting only onSetText for THAT field, but you can't do others. How can I highlight an entire column programatically based on the value of a single text field?