Torquescript seems ambiguous
by James Dunlap · in Torque Game Engine · 01/25/2006 (10:54 am) · 8 replies
I'm used to C++ programming and, to be honest, the fact that Torquescript is typeless is starting to frustrate me. It makes the script files alot harder to wrap my mind around, especially when I'm looking at method/function definitions. I'm used being able to look at the declaration, find the object type, and looking up its members in documentation. For example,
function doClientAttackAnimation(%attacker, %target)
{
...
}
If I want to look up the members of either %attacker or %target I'm stumped. Am I missing a concept here?
function doClientAttackAnimation(%attacker, %target)
{
...
}
If I want to look up the members of either %attacker or %target I'm stumped. Am I missing a concept here?
About the author
#2
My favorite is Visual Studio's, but there's other, free ones.
I search the entire source tree for things like "doClientAttackAnimation" very regularly,
it's a big help in finding out what sort of objects %attacker and %target should be.
01/25/2006 (11:20 am)
Also find a good find-in-files utility.My favorite is Visual Studio's, but there's other, free ones.
I search the entire source tree for things like "doClientAttackAnimation" very regularly,
it's a big help in finding out what sort of objects %attacker and %target should be.
#3
%attacker.dump();
is most helpfull. How do you prefer to execute it? In this instance, I'm transfering %attacker to a global variable and calling dump() from the console.
01/25/2006 (11:53 am)
Thanks, %attacker.dump();
is most helpfull. How do you prefer to execute it? In this instance, I'm transfering %attacker to a global variable and calling dump() from the console.
#4
or you could dump it in doClientAttack(),
or echo its value to the console (eg echo("attacker=" SPC %attacker);)
and then dump via the results of that,
but really your way seems better than either of those.
01/25/2006 (11:56 am)
That seems like a reasonably good way.or you could dump it in doClientAttack(),
or echo its value to the console (eg echo("attacker=" SPC %attacker);)
and then dump via the results of that,
but really your way seems better than either of those.
#5
1) How can I access individual characters withing a string? For example,
$myarray = "testing";
How can I access the letter 's' ?
Note: Sorry for the C++ syntax. I do realize that 's' is a tagged string in Torque.
2) How can I round floating point values? For example,
$f = 8.5;
How can I round this up to 9.0?
Please tell me I don't have to jump out to C++...
01/25/2006 (12:31 pm)
[snarle]Okay, speaking of Torquescript being typeless...[/snarle] I've got a few more seemingly simple questions,1) How can I access individual characters withing a string? For example,
$myarray = "testing";
How can I access the letter 's' ?
Note: Sorry for the C++ syntax. I do realize that 's' is a tagged string in Torque.
2) How can I round floating point values? For example,
$f = 8.5;
How can I round this up to 9.0?
Please tell me I don't have to jump out to C++...
#6
It's rather old, but most of it should still be relevant.
So, to answer you questions:
1). Using a combo of getSubStr() and strchr() will allow you to find individual characters in a string.
2). Use mCeil() to round up or mFloor() to round down.
01/25/2006 (1:15 pm)
This site might help you, James. www.egotron.com/torque/old_script.htmlIt's rather old, but most of it should still be relevant.
So, to answer you questions:
1). Using a combo of getSubStr() and strchr() will allow you to find individual characters in a string.
2). Use mCeil() to round up or mFloor() to round down.
#8
01/25/2006 (2:38 pm)
Thanks.
Torque 3D Owner Peter Simard
Default Studio Name
%attacker.dump();