Game Development Community

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

#1
02/18/2007 (5:10 am)
%srcObject.getName() or %dstObject.getName() depending on which of those twos name you need.
#2
02/18/2007 (5:18 am)
Thanx
i think i need a complete list of all these functions etc
#3
02/18/2007 (5:26 am)
John, use %obj.dump(); to get a list of all functions.
#4
02/18/2007 (5:39 am)
Sorry to be a pain but i am new to this
how would you exactly use the %obj.dump to get list of functions and maybe print them
#5
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
02/18/2007 (6:05 am)
I was using torsion - free version but ran out
now using jEdit -
again many thanx
#7
02/18/2007 (8:00 am)
Can't get %srcObject.getName() or %dstObject.getName() to work

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
#8
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 even
echo("You collected \"" @ %dstObj.getName() @ "\".");
#9
02/18/2007 (8:18 am)
Thanx mark
you got it going - now registering collected items' names.
#10
02/18/2007 (9:57 am)
This thread seems to be crossposted here
#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
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
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.