Game Development Community

How do I Expose Engine code for use in scripts?

by Nicolai Dutka · in Torque Game Engine · 10/02/2007 (1:29 pm) · 6 replies

So the title basically speaks for itself. I want to expose some stuff so I can use it in script.

1. I need a basic breakdown of how this works so I can use it for all kinds of things but:

2. Specifically this time, I am wanting to be able to do SOMETHING LIKE: getMaterialName() which will tell me the name of a terrain texture. This will be used with a ContainerRayCast which shoots a ray starting just above the player's head and aimed straight down at his feet so that I can get the name of the terrain material the player is standing on.

#1
10/02/2007 (1:49 pm)
Http://tdn.garagegames.com/wiki/Code/How_do_I_make_a_scriptable_object%3F

There's a start.
#2
10/02/2007 (2:01 pm)
So would a terrain material be considered an object?
#3
10/02/2007 (6:23 pm)
I do believe that the RayInfo struct or w/e that the raycasts return gives you the material information. Take a look at the footpuffs if need be.

The point of the link is for the principle of how it works so that you don't need to be spoonfed and can see how you expose things to script so that you can expose w/e you want. You learn more that way and become self-sufficient.
#4
10/02/2007 (7:14 pm)
That's exactly what I was hoping for too... to learn the 'hows and whys' of it rather than just have someone write it for me. Besides that, I am picky about optimization and especially, structure, so i usually end up re-writing most of the stuff I get from people anyway.

@AcidFaucet
I read through the entire page that you linked to me and even some others that were linked within that page (one of the links said the page wasn't built yet...). I have a pretty good idea of what is going on now. I have a rayCast starting 3m above my player's head and pointing straight at his feet extending 10m down (that should go through the terrain a little). I then have some info stored in global variables for later. I am now down to the very last hurdle:

@Anyone/Everyone
I can get all the info I need except for the actual terrain texture's name at the specified location. I am looking into another thread for info on that and will post back here what I find. Please feel free to post here before I do if you (anyone) have any more useful info.
#5
10/03/2007 (3:45 pm)
May want to check this link to see if it's inline with what you need:

http://tdn.garagegames.com/wiki/Material_Based_Effects_-_Detection_-_Legacy_Terrain
#6
10/03/2007 (4:03 pm)
@AcidFaucet

I've already got that code in my engine and it is compiled, I just don't know what to do with it so that I can use it in script to get the material name at any given position...