Game Development Community

releasing a "exec"

by Bruno · in Torque Game Builder · 07/20/2010 (10:40 am) · 3 replies

Hi everyone,

After we do something like this :

exec("./gameScripts/room6.cs");
exec("./gameScripts/room7.cs");
exec("./gameScripts/room8.cs");
exec("./gameScripts/room9.cs");

Is there a way to release this files from memory, before loading the rest of the game ?
thanks,
Bruno

#2
07/20/2010 (11:07 am)
Thanks Aditya, first time i ear about packages.
The link you posted, ends up with nothing, it's probably outdated.
I did a quick browse, does this work like this ?
I'm not at home, so I can't check this right now.

thanks,
Bruno

package chapter1
{
function LoadLevel()
{
exec("room1");
exec("room2")'
}
};

package chapter2
{
function LoadLevel()
{
exec("room3");
exec("room4")'
}
};


function aPackage(%package)
{
activatePackage(%package);
}


function dPackage(%package)
{
deactivatePackage(%package);
}






//Activate first level !

aPackage("chapter1");
LoadLevel();

//Activar o segundo nivel !!
dPackage("chapter1");
aPackage("chapter2");
LoadLevel();
#3
07/20/2010 (11:33 am)
Some problem with 'url' tag in markuplite. Copy and paste that link in your browser.

You've basically got it. Just instead of this:
package chapter1
{
function LoadLevel()
{
exec("room1");
exec("room2")'
}
};

You define the level specific code in the .cs file(chapter1.cs,chapter2.cs etc) inside the package in that file.
//chapter1.cs
package chapter1
{
function LoadLevel()
{
  //Chapter 1 code
}
};

Thus, you control the code using ActivatePackage and DeactivatePackage.