Game Development Community

Undo 'exec()' command

by Aditya Kulkarni · in Torque Game Builder · 12/07/2009 (5:14 am) · 4 replies

i need to execute a set of level specific code...so in games.cs in the gamescripts folder, i exec the .cs file for each level...

e.g:
if(%level == 1) {
      sceneWindow2D.resetSceneGraph();
      exec("./levels/level1.cs");
      sceneWindow2d.schedule( 0, LoadLevel, "level1.t2d");

   }


problem is, these variables and functions are still accessible when i load another level...how do i tell the engine not to execute code from that file?

#1
12/07/2009 (5:20 am)
you will have to use packages and enable / disable them as needed.
There is no other way to tell the engine to "forget" something you forced it to learn.
#2
12/07/2009 (5:43 am)
ok, don't have any idea about those...do you have a documentation link for packages?
#3
12/07/2009 (6:04 am)
hey i got it... thank for the help Marc!

i referred http://tdn.garagegames.com/wiki/T2D/TGBTutorials/ConsoleHelloWorld
#4
12/07/2009 (6:15 am)
if anyone else need it, the official documentation for 'package' is here:

http://tdn.garagegames.com/wiki/TorqueScript_Quick_Reference_2#package