Game Development Community

Bug in getWord both 1.3 and 1.4 TGE?

by Demolishun · in Torque Game Engine · 01/20/2007 (10:26 pm) · 1 replies

$bug::check::loc[0] ="-1 -1  0";
$bug::check::loc[1] = "0 -1  0";
$bug::check::loc[2] = "1 -1  0";
$bug::check::loc[3] ="-1  0  0";
$bug::check::loc[4] = "1  0  0";
$bug::check::loc[5] ="-1  1  0";
$bug::check::loc[6] = "0  1  0";
$bug::check::loc[7] = "1  1  0";

// show getWord bug
function bug::getWord()
{
   for(%count = 0; %count < 8; %count++)
   {           
      %pos = $bug::check::loc[%count];
      %posAfter = "1[" SPC getWord(%pos,0) SPC "]" SPC 
                  "2[" SPC getWord(%pos,1) SPC "]" SPC
                  "3[" SPC getWord(%pos,2) SPC "]";
      echo("before:"SPC %pos SPC "after:" SPC %posAfter);
   }
}

This code spits out the wrong output. It seems to lose data and it is not consistent about which one it loses. It even switches positions of the data. You will have to run it to understand what I am talking about. Either there is something really wrong with getWord or I am using it wrong.

Thanks,
Frank Carney

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67


#1
01/20/2007 (10:45 pm)
Another one of those damn whitespace issues! Do NOT put more than 1 space in the data like I did above. GetWord apparently does not like multiple whitespaces between values!

Here is a way to make it pretty but gets rid of the whitespace issues:
$clife::check::loc[0] ="-1" SPC "-1" SPC "0";
$clife::check::loc[1] = "0" SPC "-1" SPC "0";
$clife::check::loc[2] = "1" SPC "-1" SPC "0";
$clife::check::loc[3] ="-1" SPC  "0" SPC "0";
$clife::check::loc[4] = "1" SPC  "0" SPC "0";
$clife::check::loc[5] ="-1" SPC  "1" SPC "0";
$clife::check::loc[6] = "0" SPC  "1" SPC "0";
$clife::check::loc[7] = "1" SPC  "1" SPC "0";