Game Development Community

T3D 1.1 Final: problem with getWords

by Anthony Lambert · in Torque 3D Professional · 06/05/2011 (5:20 pm) · 11 replies

Build: 1.1 Pro Release

Platform: Windows 7, 64 bit

Target: getWords script method

Issues: My text is getting cut off prematurely using -1 as endIndex

Steps to Repeat:
1. Using the following script:

// Find text after command
%hudtext = getWords(%text, 2, -1);
echo("Sending (" @ %hudtext @ ") to TellHud");

2. I get the following output:

Received (tell jlkjkljkl Whats up) from (MessageHud_Edit)
Sending (Whats ) to TellHud
Received (tell jkljklj OOOOOOgie la) from (MessageHud_Edit)
Sending (OOOOOOgie ) to TellHud
Received (tell jskjsk JJSAKDSK JAKJKLSDJ **&@!*&# IIUIU) from (MessageHud_Edit)
Sending (JJSAKDSK JAKJKLSDJ **&@!*&# IIU) to TellHud
Received (tell jsdkfjsdk Hey how are you doing) from (MessageHud_Edit)
Sending (Hey how are you doi) to TellHud
Received (tell jjj This is a test) from (MessageHud_Edit)
Sending (This is a te) to TellHud
Received (tell kk This is another test) from (MessageHud_Edit)
Sending (This is a another te) to TellHud

Happens every time. Seems to be truncate the last 2 chars. I tried a different startIndex and it still cuts off the last 2 chars so it isn't related to that parm.

#1
06/05/2011 (5:40 pm)
I'm not seeing the cut off in my tests in the console ...

==>%a=getwords("aye bee cee dee eee eff", 2, -1); echo(%a);
cee dee eee eff
cee dee eee eff
==>%a = "all good things come to thise who wait"; %b=getwords(%a, 3, -1); echo(%b @ " words are");
come to thise who wait words are
all good things come to thise who wait

... have you got the latest directX installed?
#2
06/05/2011 (5:58 pm)
I have DirectX 11. Don't know if there have been updates lately but it is pretty up to date.
#3
06/05/2011 (6:08 pm)
I tried your example from the torsion command line and got:

cee dee eee e

This is really odd, not sure what is going on.
#4
06/05/2011 (6:49 pm)
OK, updated my graphics driver and that solved the problem.
#5
06/05/2011 (7:12 pm)
Well, I thought it cured it. It works fine when projects that came with T3D 1.1 are loaded. Projects that were created previous to this release do not work for me. In fact, in one project created in 1.0.1 I get no output at all. So, back to not knowing what is going on.
#6
06/05/2011 (7:13 pm)
lol, GPU ... wouldn't have thought that'd affect the returns so I didn't mention it. :)
#7
06/06/2011 (7:29 am)
Yes, I wouldn't think so but I didn't want to leave any possible reaction out of the picture.
#8
06/06/2011 (12:46 pm)
I can't speak to what is going on with 1.1 but the -1 option was just added in 1.1. It was not in 1.0.1.
#9
06/06/2011 (3:51 pm)
oh, well, that would explain it then for the 1.0.1, thanks. Was there something fixed in 1.1 final compared to 1.1 beta 3? The other one giving me problems was built in beta 3.
#10
06/06/2011 (4:01 pm)
Well, I guess that doesn't really explain it since all the scripts are recompiled in 1.1 then it should work I would assume. Ah well.
#11
06/06/2011 (7:28 pm)
I downloaded Beta3 and started fresh. Created a new world, compiled it in VC 2008, started debug, went to the command line and executed:

%a=getWords("aaa bbb ccc ddd eee fffff", 2, -1); echo(%a);

and got:

ccc ddd eee fff

So, something is obviously up. I don't know if it is due to VC++ 2008 instead of VC++ 2010 or what. Anyone have any ideas?