Game Development Community

Scripting Help

by Tom Perry · in Torque Game Engine · 06/04/2005 (1:02 pm) · 2 replies

I have a question that i assume is quite simple, but i am new to this programming thing. I have been reading through 3DPAI1 and several other tutorials and I am stuck. This is best explained with an example.
In chapter 5 of the book Ken shows us the player.cs code and what it does. One of the functions is MaleAvatar::onCollision(%this,%obj,%col,%vec,%speed). It then continues to do some things with this information. Now as i understand it, this function is called by the engine when your avatar collides with somthing. So that parameter list is used so that it matches with the information the engine passes to the function. Now then later on we have an onCollision for an item, but it only have the first 3 parameters, not %vec and %speed. So i assume there are separate functions for the player class and the item class.
Basically I would like to know if I am on the right lines; are there already pre-defined funtions that the engine call? If so is there a resource or somthing that has them all listed so I know what parameters I have to work with and what functions are already being called? If this is all wrong, can someone please tell me as I am very confused!
Thanks to anyone that can help.

#1
06/04/2005 (7:52 pm)
Yes, you are on the right track. The engine calls specific script functions, which can differ from class to class (for those that share similar functionality)

At the moment I don't find the function listings, though I think those lists mainly held consoleMethod calls which are usually not the functions the engine calls for events. Since you have a liscence you can search the source for the actual calls to script. the function the engine uses to call a script function is con::executeF(), but you can search for the specific script call by name, just remember to not include the classname and :: namespace operators in the search.
#2
06/05/2005 (2:33 am)
Ok thanks for the help.