TorqueScript limitation - is perception reality?
Posted: Mon Mar 14, 2016 4:31 pm
I've come across an issue working with script files
When creating a material or object via script, and just script (ala transient), having numbers in the generated object's name seems to make things screwy.
IE, if I had a loop to create several materials like so
0_testmaterial
1_testmaterial
2_testmaterial
3_testmaterial
However, if you go ahead and try to call any of these by script you'll get a parse error.
parse error.
note: They'll RETURN the name you gave them if called, but basically it seems to be even though you create a material with a given name, it doesn't link up to it in a way you'd expect, because of the numbers. I can create materials just fine via script as long as their names are either pure int or pure string, there just isn't an in between.
I haven't done more extensive testing but this appears to go for more than just materials. Why is this limitation in place?
PS: Have looked through the cpp's but unfortunately the declarations I'm looking at are all 'String', which to my understanding is about as loose as you can get with a variable type in C++.
When creating a material or object via script, and just script (ala transient), having numbers in the generated object's name seems to make things screwy.
IE, if I had a loop to create several materials like so
for(%i = 0; %i < 4; %i++) { %newmat = new Material(%i@"_testmaterial"); }output is
0_testmaterial
1_testmaterial
2_testmaterial
3_testmaterial
However, if you go ahead and try to call any of these by script you'll get a parse error.
eval("0_testmaterial.getID();");output is
parse error.
note: They'll RETURN the name you gave them if called, but basically it seems to be even though you create a material with a given name, it doesn't link up to it in a way you'd expect, because of the numbers. I can create materials just fine via script as long as their names are either pure int or pure string, there just isn't an in between.
I haven't done more extensive testing but this appears to go for more than just materials. Why is this limitation in place?
PS: Have looked through the cpp's but unfortunately the declarations I'm looking at are all 'String', which to my understanding is about as loose as you can get with a variable type in C++.