Game Development Community

Text object "setText" not working.

by Nic Biondi · in Torque Game Builder · 06/29/2008 (8:43 pm) · 10 replies

Anyone having problems changing text objects that are moving? I am having a few problems. One is that it jiggles all over the place when it's moving.

The second problem is "setText" doesn't seem to work. I have to just go $PowerText.text=%tmp; to get it to work but it seems really fussy. What's the deal kids?

thanks
-nic

#1
06/29/2008 (8:49 pm)
"setText" isn't an actual function for t2dTextObjects, you just have to use the field "text" as you have been. What do you mean by "fussy", or are you just fussy? ;)

Describe "jiggle" a little bit better. Are you using linear/angular/impulse velocities? Setting the position manually?
#2
06/29/2008 (9:05 pm)
Ok. so that piece of turd just didn't work when I called in inside a function 2 deep. Don't know why that would bug the text object.. but it did. I had one function calling a second one:

this doesnt work:
function first()
{
  second();
}

function second()
{
  textObj.text=$pBall.jumpPower;
}

this does:
function first()
{
  textObj.text=$pBall.jumpPower;
}
I sure hope I'm just an idiot, because I wasted a good 2 hrs of my life on this crap! venting finished. lol
#3
06/29/2008 (9:08 pm)
Ah Phillip. thanks for the reply. Didn't see that befor my last post. "Jiggling" is a happening because when I reset the text object quickly... "onUpdate", it fidgets on the mount somehow. I'm releasing a little steam since I have now found a funky way to get it to actually accept the values as I expect. I'll probably be able to work though the "jiggling" and will post the solution if I find it.

Shouldn't there be a setText or setValue function associated with that object to be more inline with the rest of the torque code?
#4
06/29/2008 (9:18 pm)
Here is the jiggling you questioned about: http://www.youtube.com/watch?v=q9yWIdbAURA
I just created a little vid
#5
06/29/2008 (9:27 pm)
With regards to your nested function issue, I suspect that you're not passing the object reference through the function. When you set the text, place an echo function similar to this:

echo( %textObjId SPC %textValue);

If you find that there is nothing there, then you need to double check your function arguements.

I suspect that you're physically changing the position of the object somewhere in the onUpdate function. If you're mouting/dismounting, this would definitely cause the problem.
#6
06/29/2008 (9:32 pm)
Here is the jiggling you questioned about: http://www.youtube.com/watch?v=q9yWIdbAURA
I just created a little vid
#7
06/29/2008 (9:35 pm)
"I suspect that you're not passing the object reference through the function"
Thanks for the suggestion. However, I was using a global variable so I don't think that was the issue.

On the jiggling side of things. I only mount it once.. and don't call any updates for the position. However it's possible I mounted to something that is getting updated frequently. I will take a peek at that.
#8
06/29/2008 (9:45 pm)
"I suspect that you're not passing the object reference through the function"
Thanks for the suggestion. However, I was using a global variable so I don't think that was the issue.

On the jiggling side of things. I only mount it once.. and don't call any updates for the position. However it's possible I mounted to something that is getting updated frequently. I will take a peek at that.
#9
06/29/2008 (9:49 pm)
Hmm. Well I have seen this kind of jigglin if you do update a position often.. but usually you can fix this by mounting to to whatever you are tracking. The renderer then keeps it in motion relative to other objects. However I have it mounted properly and am not updating it except to change the text. I think that somehow updating the text is causing it to somehow get out of sync as it moves. When your standing still it has no problems. I have it mounted exactly the same way a couple static2d sprites and they work right. I bet if I created my own text sprites they would work like a champ too.

** Anyone use the text2d object in motion and have it work/not work for you? **

thanks!
-nic
#10
06/29/2008 (9:59 pm)
Oh and ps.. I'm just a little fussy. Need to step away from the "puter" once in a while ;D