Bug T3D 1.1 Beta 1&2: Issue with "?" if statement + Code to reproduce - LOGGED
by elvince · in Torque 3D Professional · 07/13/2010 (3:04 am) · 10 replies
Build: 1.1 Beta 2 & 1
Platform: Windows 7 64 bit,
Target:all
issue:
When using such statement I have always %scale set to 0 or 1:
%scale=(%obj.DEX/%this.level >1) ? 1 : (%obj.DEX/%this.level);
If I put
%scale=(%obj.DEX/%this.level >1) ? 1 : 2;
I will have 1 or 2.
if I echo (%obj.DEX/%this.level >1) ? 1 : (%obj.DEX/%this.level) the value is correct.
Code to reproduce the issue:
When you need the result in a variable, the ? works if the final value is not a variable.
Echo function it's working perfectly.
ex: %test= (%dex/%level >1)?1:4; will put 4 as output for %test
WorkAround: Put 1.0 instead of 1.
Fix: n/A
Platform: Windows 7 64 bit,
Target:all
issue:
When using such statement I have always %scale set to 0 or 1:
%scale=(%obj.DEX/%this.level >1) ? 1 : (%obj.DEX/%this.level);
If I put
%scale=(%obj.DEX/%this.level >1) ? 1 : 2;
I will have 1 or 2.
if I echo (%obj.DEX/%this.level >1) ? 1 : (%obj.DEX/%this.level) the value is correct.
Code to reproduce the issue:
function test()
{
%level= 4;
%dex=2;
%test= (%dex/%level >1)?1:%dex/%level;
echo("test:"@%test);
%test= %dex/%level;
%test= %test>1?1:%test;
echo("test:"@%test);
echo((%dex/%level >1)?1:%dex/%level);
}Result are: 0 0 0.5When you need the result in a variable, the ? works if the final value is not a variable.
Echo function it's working perfectly.
ex: %test= (%dex/%level >1)?1:4; will put 4 as output for %test
WorkAround: Put 1.0 instead of 1.
Fix: n/A
About the author
Recent Threads
#2
thanks,
07/13/2010 (4:37 am)
I use Echo as a verb not the function^^ but in all case, the issue is here except if you tell me that's everything is ok on your side!thanks,
#3
07/13/2010 (11:23 am)
What are the values of %obj.DEX and %this.level? Could be a problem with their values.
#4
the thing is when I echo the formula value, it's working fine, it's just when I need to put this value in a variable where it's not working.
07/14/2010 (2:41 pm)
for example: Dex =4 and level = 2.the thing is when I echo the formula value, it's working fine, it's just when I need to put this value in a variable where it's not working.
#5
Could also be a precision error, I believe there was a previous post about precision being off.
07/14/2010 (3:38 pm)
There might be a problem with the script engine reading the formula. Try this instead:%test = %obj.DEX / %this.level; %scale = (%test > 1) ? 1 : %test; echo(%test); echo(%scale);
Could also be a precision error, I believe there was a previous post about precision being off.
#6
When you need the result in a variable, the ? works if the final value is not a variable.
But in Echo function it's working perfectly.
ex: %test= (%dex/%level >1)?1:4; will put 4 as output for %test
I hope GG will be able to fix this in Beta2!
07/14/2010 (9:51 pm)
function test()
{
%level= 4;
%dex=2;
%test= (%dex/%level >1)?1:%dex/%level;
echo("test:"@%test);
%test= %dex/%level;
%test= %test>1?1:%test;
echo("test:"@%test);
echo((%dex/%level >1)?1:%dex/%level);
}Result are: 0 0 0.5When you need the result in a variable, the ? works if the final value is not a variable.
But in Echo function it's working perfectly.
ex: %test= (%dex/%level >1)?1:4; will put 4 as output for %test
I hope GG will be able to fix this in Beta2!
#7
It's a precision issue.
Do like this:
07/15/2010 (5:19 pm)
It's a precision issue.
Do like this:
function test()
{
%level= 4;
%dex=2;
%test= (%dex/%level >1)?1.0:%dex/%level;
echo("test:"@%test);
%test= %dex/%level;
%test= %test>1?1.0:%test;
echo("test:"@%test);
echo((%dex/%level >1)?1:%dex/%level);
}
#8
I hope this fix that already taken into account. In the mean time, the 1.0 will do the job.
07/15/2010 (7:19 pm)
thanks for those feedback. I hope this fix that already taken into account. In the mean time, the 1.0 will do the job.
#9
08/05/2010 (7:23 am)
issue still in BEta 2
#10
08/11/2010 (9:12 pm)
Logged as TQA-794 for the QA team to verify.
Torque 3D Owner JANR
Your echo statement is not correct.
Use:
echo ((%obj.DEX/%this.level >1) ? 1 : (%obj.DEX/%this.level))