Tell me whats wrong with this?
by Jared Reno · in Technical Issues · 07/19/2007 (11:11 am) · 8 replies
Function MoveShape(%shape, %dist)
{
echo("MoveShape: shape id ", %shape);
echo("MoveShape: distance: ",%dist);
%xfrm = %shape.getTransform();
%1x = getword (%xfrm,0);
%1y = getword (%xfrm,1);
%1z = getword (%xfrm,2);
%1x+=%dist;
%shape.setTransform(%1x SPC %1y SPC %1z SPC "0 0 1 0");
echo ("MoveShape: done.");
}
Opon execution of this script I get a syntax error on line 6. Ive looked it over but I cant find one. I took out the little side notes figuring it wasnt reading the slashes right and not voiding them. Didnt work. Ive retyped it after writing it down and going over it millions of times. Tell me what Ive done wrong. All errors please. Thanks!
{
echo("MoveShape: shape id ", %shape);
echo("MoveShape: distance: ",%dist);
%xfrm = %shape.getTransform();
%1x = getword (%xfrm,0);
%1y = getword (%xfrm,1);
%1z = getword (%xfrm,2);
%1x+=%dist;
%shape.setTransform(%1x SPC %1y SPC %1z SPC "0 0 1 0");
echo ("MoveShape: done.");
}
Opon execution of this script I get a syntax error on line 6. Ive looked it over but I cant find one. I took out the little side notes figuring it wasnt reading the slashes right and not voiding them. Didnt work. Ive retyped it after writing it down and going over it millions of times. Tell me what Ive done wrong. All errors please. Thanks!
About the author
#2
07/19/2007 (11:30 am)
Error still there.
#3
07/19/2007 (11:34 am)
I guess variables must not start with numbers.
#4
And how could I replace it then? if the X,Y,Z thing dont work out to well.
07/19/2007 (11:45 am)
So tell me what would happen if I took out the numbers and just left it as X,Y,Z?And how could I replace it then? if the X,Y,Z thing dont work out to well.
#5
07/19/2007 (12:29 pm)
Correct, Torquescript variables cannot start with numbers (alpha only). I don't see any other glaring errors, but that doesn't mean you won't find others.
#6
07/19/2007 (12:39 pm)
So numbers out and im good to go.
#7
07/19/2007 (12:47 pm)
It did work. I took them out and it worked perfectly. Thanks alot guys.
#8
07/20/2007 (6:59 am)
Oh yeh, i didn't catch that :/
Torque 3D Owner mb
%1x = getWord(%xfrm,0);