First, I would do this at the scene level. I've just had better results. Then I would run it at the OnOnline, OnRender, and onPreviewRender. Since you're not just dealing with text, but with object visibility.
Then try this code:
dim txt as xpTextObject
dim obj as xpBaseObject
self.GetObjectByName("Your Text Object's Name", txt)
self.GetObjectByName("Your Object's Name", obj)
if txt.text = 1 then
obj.visible = true
elseif txt.text = 0 then
obj.visible = false
end if
Since your values are known, you should specify by using
elseif instead of
else. If your text could be anything, but only if it was "1" you wanted something visible, then I would say to do that the other way.
Another method I've had success with is using
InStr, or "In String." This function returns the number of characters within $A that $B falls at. For example, if
$A=abcdefg
InStr($A, "b") would return 2
InStr($A, "d") would return 4
etc...
I would use this:
if InStr(txt.Text, "1") = 1 then
obj.visible = True
else
obj.visible = False
end if
That would say "if the first character in your text is 1, then make it visible, otherwise hide it."
#XPression