Game Development Community

SetText/getText on a t2dTextObject (from script)

by Randy Condon · in Torque Game Builder · 05/12/2008 (6:38 pm) · 2 replies

I'd love to see a way to set and get text on a t2dTextObject.

I see there is a setText in the code, but not exposed to script. (Which I've exposed to script on my build).

This would be valuable for a number of reasons, one being allowed to change text when switching languages.

If there is an easy way to do this that I have missed, my apologies. (and I would love if you could let me know the method).

Thanks

#1
05/12/2008 (6:41 pm)
There aren't functions to set / get the text but you can set the field "text" to the value you want.

// Set text
%textObj.Text = "My New Test";
 
// Get text
echo (%textObj.Text);
#2
05/13/2008 (9:26 am)
And so you can. I tried that with a test case, but wouldn't you know it, my test case had a bug so it didn't work. Now when I went back and did a proper test case, it works just as Phillip said it would.

thanks Phillip.