Detecting name not class
by John Turner · in Torque Game Builder · 02/18/2007 (4:38 am) · 14 replies
I know how to use the on oncollision function to detect a class of objects
but how do you detect the name of an object in a class
thnx
but how do you detect the name of an object in a class
thnx
About the author
#3
02/18/2007 (5:26 am)
John, use %obj.dump(); to get a list of all functions.
#4
how would you exactly use the %obj.dump to get list of functions and maybe print them
02/18/2007 (5:39 am)
Sorry to be a pain but i am new to thishow would you exactly use the %obj.dump to get list of functions and maybe print them
#5
Although, the script reference should give you some hints (I on my end spend 40$ on torsion which has a +- working autocompletition and intellisense which helps in such cases by showing all get Functions if I write .get :) )
02/18/2007 (6:02 am)
Put an echo(%srcObject.dump()); into your collision callback and check out the console.log afterwards :)Although, the script reference should give you some hints (I on my end spend 40$ on torsion which has a +- working autocompletition and intellisense which helps in such cases by showing all get Functions if I write .get :) )
#6
now using jEdit -
again many thanx
02/18/2007 (6:05 am)
I was using torsion - free version but ran outnow using jEdit -
again many thanx
#7
function PlayerFish::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if(%dstObj.class $= "FoodClass")
{
%collect = %dstObj.getName();
test.text=%collect;
}
this is part of script - the obect has a name and a class put inton the scripting level editor
please help
02/18/2007 (8:00 am)
Can't get %srcObject.getName() or %dstObject.getName() to workfunction PlayerFish::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
if(%dstObj.class $= "FoodClass")
{
%collect = %dstObj.getName();
test.text=%collect;
}
this is part of script - the obect has a name and a class put inton the scripting level editor
please help
#8
echo("You collected \"" @ %dstObj.getName() @ "\".");
02/18/2007 (8:11 am)
Did you try to find out if it even gets into the IF by echo-ing something within the IF, perhaps evenecho("You collected \"" @ %dstObj.getName() @ "\".");
#11
02/19/2007 (5:47 pm)
Just a side note regarding the console function: just %object.dump(); is sufficient. Calling echo(%object.dump()); will just print some extra garbage at the end that has nothing to do with the object.
#12
A plain list is all I need to give an over-view of what is on offer - I know there are reference docs with the prog but a simple list is sometimes good th have
02/22/2007 (9:36 am)
Have you got any more useful tips for listing torque script language A plain list is all I need to give an over-view of what is on offer - I know there are reference docs with the prog but a simple list is sometimes good th have
#13
02/22/2007 (9:59 am)
@John: that's exactly what %obj.dump(); does.
#14
I'm in love with the TGB Reference document. It has most every function in it with descriptions. You'll need to use the Particle document for all particle effect functions though, the normal Reference doc doesn't cover some of them.
06/11/2007 (9:27 am)
Quote:Have you got any more useful tips for listing torque script language
I'm in love with the TGB Reference document. It has most every function in it with descriptions. You'll need to use the Particle document for all particle effect functions though, the normal Reference doc doesn't cover some of them.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft