Concatenation problem
by Drew Madsen · in Torque Game Engine · 08/14/2009 (7:35 am) · 2 replies
Making a for loop to call a variable using concat, getting a syntax error and can't see it.
%meleeP1 = gettranpos(%this.getslottransform(29));
%foeP0 = gettranpos(%foe.getslottransform(19));
%foeP1 = gettranpos(%foe.getslottransform(20));
%foeP2 = gettranpos(%foe.getslottransform(21));
%foeP3 = gettranpos(%foe.getslottransform(22));
%foeP4 = gettranpos(%foe.getslottransform(23));
%foeP5 = gettranpos(%foe.getslottransform(24));
%foeP6 = gettranpos(%foe.getslottransform(25));
%foeP7 = gettranpos(%foe.getslottransform(26));
%hit = 0;
for (%i = 0; %i<8; %i++)
{
%foepoint = "%foeP"@%p@;//<-The Line that gets an error
if (vectordist(meleeP1,%foepoint)<1)
%hit = 1;
}
The syntax error comes up when I set %foepoint
%meleeP1 = gettranpos(%this.getslottransform(29));
%foeP0 = gettranpos(%foe.getslottransform(19));
%foeP1 = gettranpos(%foe.getslottransform(20));
%foeP2 = gettranpos(%foe.getslottransform(21));
%foeP3 = gettranpos(%foe.getslottransform(22));
%foeP4 = gettranpos(%foe.getslottransform(23));
%foeP5 = gettranpos(%foe.getslottransform(24));
%foeP6 = gettranpos(%foe.getslottransform(25));
%foeP7 = gettranpos(%foe.getslottransform(26));
%hit = 0;
for (%i = 0; %i<8; %i++)
{
%foepoint = "%foeP"@%p@;//<-The Line that gets an error
if (vectordist(meleeP1,%foepoint)<1)
%hit = 1;
}
The syntax error comes up when I set %foepoint
About the author
#2
I'm using p in my script on my lap top, I switched to the for with the %i just to give the example.
Pretty sure this info will get things working for me.
08/14/2009 (2:24 pm)
Ahh thankyou!I'm using p in my script on my lap top, I switched to the for with the %i just to give the example.
Pretty sure this info will get things working for me.
Torque Owner Ryan Mounts
CornerstoneViz
eval("%foepoint = %foeP" @ %i @ ";");
This command will form the string "%foepoint = %foeP0;" for example, and execute it.