Game Development Community

About packages

by Manuel F. Lara · in Torque Game Builder · 06/02/2006 (7:22 am) · 4 replies

Is there a way to access the current stack of packages? I mean, being able to pop the last pushed package without knowing its name, and stuff like that?

#1
06/02/2006 (7:53 am)
I don't know about that but it would be really easy to write some script functions that do that for you.
#2
06/06/2006 (5:05 pm)
$packages = new SimSet(LoadedPackages){
       packages = "";
       count="0";
};

function AddPackages(%this,%packageName)
{
            //Increment Package Count
            %this.packages[%this.count] = %packageName;
            activatePackage(%packageName);
            %this.count++;
}

function RemovePackages(%this,%val)
{
        deactivatePackage(%this.packages[%val]);
        %this.packages[%val] = "";
}

AddPackages($packages,"myPackage");

//Pop off Most Recent
RemovePackages($packages.count - 1);
Something like this is what I'm using, but a bit cleaner....
#3
06/06/2006 (10:53 pm)
Thanks Rodney, very helpful :)
#4
06/06/2006 (11:50 pm)
Welcome, you'll want to do some error checking and the counts should be reordered probably.. this was mostly a psuedo example at best ...

Glad it helped...