Game Development Community

New To TGB, Quick Script Question

by John Williams · in Torque Developer Network · 12/11/2008 (12:34 pm) · 3 replies

I have just begun looking at the Fish Game Tutorial , and see the following;

function PlayerFish::onLevelLoaded(%this, %scenegraph)
{

}

"Then we get to the actual function name (onLevelLoaded), which you might have guessed gets called when our fish gets loaded into the level."

1. Is onLevelLoaded a built-in function of TGB Script, and if so, were can I find reference to other built in "events" of TGB.

2. Can I create my own functions based on an object?


Thanks in Advance;

John

About the author

Recent Threads

  • Tile Maps Question (HEX)

  • #1
    12/11/2008 (2:28 pm)
    1. Yes, it is a script callback that gets called when a level is loaded. You can find more references at tdn.garagegames.com. You can also click here.

    2. Yes, you can.

    function PlayerFish::myFunction(%this)
    {
       echo("myFunction was called.");
    }
    
    function PlayerFish::onLevelLoaded(%this, %scenegraph)
    {
       %this.myFunction();
    }

    If you have any more questions, feel free to post them or email me and I'll answer them as best I can.
    #2
    12/12/2008 (11:53 am)
    Cool, thank you very much.
    #3
    02/09/2009 (10:46 am)
    > 1. Yes, it is a script callback that gets called when a level is loaded.
    > You can find more references at tdn.garagegames.com. You can also click
    > here.

    I was wondering some of the same things as the OP, but what I really want to know is whether there is a language manual for TorqueScript? The free TGB kit comes with help that includes tutorials and a reference manual for torque objects, but I haven't been able to get answers to such basic things as what callbacks are defined, what is the meaning of a "Level", and even whether the same language applies to all the different Torque products. Unfortunately, every time I look for references on Garage Games' pages, all I find are links to the same page I got here from, as above (or the tutorials).

    Is there a manual?