Question of Scripting
by J L · in Torque 3D Professional · 03/02/2011 (8:44 am) · 6 replies
What in this line is different about the teamid and teamId. and please elaborate on the question
if (%teamid == %this.team.teamId)
About the author
#2
03/02/2011 (10:14 am)
Maybe I should have been more clear. I have read that in some points torque script is case sensitive. Is this one of those issues where teamid and teamId have two different purposes?
#3
Meaning, when you're using variable names keep them consistent in case as it is good practice to do so.
03/02/2011 (11:08 am)
I just performed various tests and TorqueScript is NOT case-sensitive. But it is a good idea to assume TorqueScript would be case-sensitive as pretty much all other scripting languages like JavaScript, PHP, etc.. are. So, practice makes perfect.Meaning, when you're using variable names keep them consistent in case as it is good practice to do so.
#4
I suppose I can make it so if I really want it.
03/02/2011 (12:42 pm)
The docs state that TorqueScript is not case sensitive. I sure wish it was, though....I suppose I can make it so if I really want it.
#5
So just to reiterate what Nathan said:
%teamid is a temporary (local) variable of "something" - could represent abything, you didn't say - and .teamID is a variable of .team - which is a variable of %this, which is the local variable of the object in the method (function).
Also read Nathan's link.
03/02/2011 (12:47 pm)
You can read a string that is caseSensItiVe if you want (check out string comparison functions in the docs) but it's in no way neccessary.So just to reiterate what Nathan said:
%teamid is a temporary (local) variable of "something" - could represent abything, you didn't say - and .teamID is a variable of .team - which is a variable of %this, which is the local variable of the object in the method (function).
Also read Nathan's link.
#6
In your example %teamid is the name of variable in the scope of this function, and .teamId is simply a property of .team which is a property for the variable %this -- the case of either is meaningless in that both are simply labels (or names if you prefer) and two separate indentifiers -- and is simply comparing one to the other.
What has happened is that %teamid was presumably passed down to this function (-1 to n) and your example is comparing the variable to this objects team which has an id representation (-1 to n).
03/02/2011 (1:14 pm)
bah! had tried posting earlier but the website crapped out - as usual...In your example %teamid is the name of variable in the scope of this function, and .teamId is simply a property of .team which is a property for the variable %this -- the case of either is meaningless in that both are simply labels (or names if you prefer) and two separate indentifiers -- and is simply comparing one to the other.
What has happened is that %teamid was presumably passed down to this function (-1 to n) and your example is comparing the variable to this objects team which has an id representation (-1 to n).
Torque Owner Nathan Martin
TRON 2001 Network
%this is also a local variable.
%this.team.teamId is a member variable of team member variable of %this.
Read more about Torque Scripting in general here: docs.garagegames.com/torque-3d/official/index.html?content/documentation/Scripti...