Hi Malcolm,
That makes it a bit trickier but still not too bad.. The reason being is that you would need to update the material when either type of timeout changes. Therefore both text objects would need an OnSetText script that would each look at their own value and add the value of the opposite text object.
Normally I would highly discourage an OnSetText script from reading a different text object because you run into a race condition. They won't both change at exactly the same time, so one script will always run first, then almost instantly the other script will execute. Since you can't predict in which order they will get updated you can sometimes run into weird side effects you wouldn't expect. This probably won't make any difference to you though, since all you are doing is adding the two values together and setting a material. I have seen cases where people have really complicated scripts with a lot of logic and they'll get bizarre effects they weren't expecting (but make perfect sense when you understand the two text objects won't change at precisely the same time).
In order to add the two values together you'll first need to convert the strings into integers. This wasn't needed in the first example I gave you because we could just tack the timeout value as a string onto the end of the "Timeout" to form a material name.. The VB function CInt() can convert a string to an integer.
Here is the two scripts.
Add this to a text object called Full:
dim Timeouts as Integer
dim Material as xpMaterial
dim Quad as xpBaseObject
dim Half as xpTextObject
Scene.GetObjectByName("TimeoutQuad", Quad)
Scene.GetObjectByName("Half", Half)
Timeouts = CInt(Half.Text) + CInt(Text)
engine.GetMaterialByName("Timeout" & Timeouts.ToString, Material)
Quad.SetMaterial(0, Material)
and add this to a Text Object called Half:
dim Timeouts as Integer
dim Material as xpMaterial
dim Quad as xpBaseObject
dim Full as xpTextObject
Scene.GetObjectByName("TimeoutQuad", Quad)
Scene.GetObjectByName("Full", Full)
Timeouts = CInt(Full.Text) + CInt(Text)
engine.GetMaterialByName("Timeout" & Timeouts.ToString, Material)
Quad.SetMaterial(0, Material)
#XPression