Game Development Community

scripting

by Mirko Topalski · in Torque Game Builder · 04/28/2009 (11:36 pm) · 5 replies

Hi

Can anybody help me , i am finishing breakout tutorial i have to include scripts in it but i dont know how to include scripts , where do i write them.

#1
04/29/2009 (5:12 am)
To get the engine to execute a script, add a line
exec("./scriptname.cs");
to the function startGame, in the file game/gameScripts/game.cs

It should look like
function startGame(%level)
{
   exec("./mouse.cs");
   Canvas.setContent(mainScreenGui);
   Canvas.setCursor(DefaultCursor);
   
   new ActionMap(moveMap);   
   moveMap.push();
   
   $enableDirectInput = true;
   activateDirectInput();
   enableJoystick();
   
   sceneWindow2D.loadLevel(%level);
}
#2
04/29/2009 (5:16 am)
Also,
I suggest starting on the tutorials on this page
www.garagegames.com/documentation/tgb
rather than those on TDN, as the ones above start out a bit slower.
#3
04/29/2009 (6:14 am)
thank you xfire, i appriciate thath but i dont know there in tgb i write scripts. Can you help me on thath.thank you.

#4
04/29/2009 (8:21 am)
Scripts go in <ProjectName>/game/gameScripts/

You create the files either with a normal text editor (like notepad), or a script IDE tool like torsion. The Torque Game Builder tool does not have any script editing capability in it.
#5
05/01/2009 (11:41 am)
Torsion is awesome. I don´t know what my life would be without it!