Strange issue in Version 1.5.2
by Gonzo T. Clown · in Torque Game Engine · 03/15/2008 (11:36 pm) · 1 replies
Been having the strangest problem the last few days, and tonight I finally figured out some very strange stuff. Take the following function that confirms sequential numbers for example...
using...
reconfirmSequence(1,2,3,4,5);
in TGE version 1.4.2 returns true as it should, but in TGE version 1.5.2 it returns false. So I figured the only way it could be false is if the numbers were not being passed through and I added a line to echo out the values to see what they were...
and all of a sudden the function works perfectly and the numbers I sent are echoed back out. So I comment out the 'echo' line and now the function doesn't work. Comment it back in, and it does. You can also get it to work if you restate the variables such as the following example...
But this is obviously not an acceptable solution. This issue appears to be a problem with 1.5.2 as far as I can tell. All my tests on 1.4.2 showed it to work fine. Can anyone else confirm they have the same issue please?
Thank You
function reconfirmSequence(%num1, %num2, %num3, %num4, %num5)
{
%confirm = true;
for(%i = 1; %i < 5; %i++)
{
if(%num[%i] == %num[%i + 1] - 1)
{
echo("Matched Num");
}
else
{
echo("Match Failed");
%confirm = false;
%i = 5;
}
}
return %confirm;
}using...
reconfirmSequence(1,2,3,4,5);
in TGE version 1.4.2 returns true as it should, but in TGE version 1.5.2 it returns false. So I figured the only way it could be false is if the numbers were not being passed through and I added a line to echo out the values to see what they were...
function reconfirmSequence(%num1, %num2, %num3, %num4, %num5)
{
echo("Reconfirm Sequence = " @ %num1 SPC %num2 SPC %num3 SPC %num4 SPC %num5);
%confirm = true;
for(%i = 1; %i < 5; %i++)
{
if(%num[%i] == %num[%i + 1] - 1)
{
echo("Matched Num");
}
else
{
echo("Match Failed");
%confirm = false;
%i = 5;
}
}
return %confirm;
}and all of a sudden the function works perfectly and the numbers I sent are echoed back out. So I comment out the 'echo' line and now the function doesn't work. Comment it back in, and it does. You can also get it to work if you restate the variables such as the following example...
function reconfirmSequence(%numa, %numb, %numc, %numd, %nume)
{
%num1 = %numa;
%num2 = %numb;
%num3 = %numc;
%num4 = %numd;
%num5 = %nume;
%confirm = true;
for(%i = 1; %i < 5; %i++)
{
if(%num[%i] == %num[%i + 1] - 1)
{
echo("Matched Num");
}
else
{
echo("Match Failed");
%confirm = false;
%i = 5;
}
}
return %confirm;
}But this is obviously not an acceptable solution. This issue appears to be a problem with 1.5.2 as far as I can tell. All my tests on 1.4.2 showed it to work fine. Can anyone else confirm they have the same issue please?
Thank You
About the author
Torque Owner Lee Latham
Default Studio Name
It's the classic "it works in debug but not in release" problem. How wonderful! I'm glad it's not my problem. :-) j/k.
Do you use an IDE like Torsion?