Game Development Community

TGB 1.7.2 dynamic fields not saved?

by James Ford · in Torque Game Builder · 03/06/2008 (12:23 am) · 1 replies

Ok figured it out, and it doesn't have anything to do with dynamic fields..
I would consider this a bug, at least it completely stalled me for 2 hours...

When you do %scenegraph.pickPoint(...) or other similar methods, even if the returned result is only a single object, and when echoed looks like "1357" for instance. It actually has a space/tab or something character on the end, SO..

If you naively try something like:

%obj = %scenegraph.pickPoint(...);
echo( %obj.dynamField1 );

You will get an asterisk character ( at least i did ) or some other garbage perhaps as output.

Even though you can't see the invisible character on the end that is the source of your misery, you must do this:
%result = %scenegraph.pickPoint(...);
%obj = getWord( %result, 0 );
echo( %obj.dynamField1 );

A nice change could be to NOT put this space character in the results string returned by "pickPoint" and the like methods, if it is a single result.

#1
03/06/2008 (12:40 am)
Alternatively:

%result = trim(%scenegraph.pickPoint(...));

I wouldn't consider this a bug, however. What you *should* do is loop through all of the objects in the list and make sure that you get the one that you want. If you do this then you will never get the problem you mention. If you assume that there will only ever be one object then it may cause you problems later on.