I knew I had something on packages:
"Be careful with packages

-------------------------------------------------------------------------=
-------
Wizard_TPG
TAC Development Team
http://www.tribes-universe.com/tac/Wizardsworld
http://www.tribalwar.com/wizard/----- Original Message -----
From: Wizard_TPG=20
To:
t2scripters@gameshrine.comSent: Thursday, November 23, 2000 8:12 AM
Subject: Package Overview
This document is designed as an overview to explain the basic usage of
the package functions included in Tribes 2 Coding. A package is
basically used to temporarily replace an existing function (or numbers
of functions) with new code. For those that understand inheritance, a
package is a child of the original function. In the most basic form it
will simply replace the existing code in the function.
Basic Form
Here is a very basic example.
Original Functions:
function Armour::BlaBla1 (%this,%obj)
{
echo("Dum de Dum Dum");
}
function Vehicle::BlaBla2 (%player,%col,%obj)
{
echo("Stupid ground hurt me!");
}
The package:
package TestPack1
{
function Armour::BlaBla1 (%this,%obj)
{
echo("I hate foo!");
}
function Vehicle::BlaBla2 (%player,%col,%obj)
{
echo("Arghhhhhh");
parent::BlaBla2(%player,%col,%obj);
}
};
When you exec a package it stays dormant until it is activated. So to
activate this package we would us the command:
ActivatePackage(TestPack1);
Now on running the function Armour::BlaBla1 returned is:
I hate foo!
If we deactivate the package by using the command
DeactivatePackage(TestPack1);=20
The output would return to:
Dum de Dum Dum
Note: This package can be re-activated at any time.
Inheritance
Pretty awesome huh? Now we can start to get into the more powerful side
of the package. Inheritance. I am not going ot explain inheritance but
am just gonn aexplain what you can do with a package. There is another
command in T2 that is used in the example above. This command actually
brings the code from the previous function into our package function so
we are just "adding" code to it.
In the example above.....prior to activation we get
Stupid ground hurt me!
and after activating we get
Arghhhhhh
Stupid ground hurt me!
Once again, as above, this can be deactivated and activated as you see
fit at any time.
Running Multiple Packages
So what happens if you run a package that alters a function, and then
run another that alters the same function? Well.....no problems, it
works. If you then deactivate the second package that is fine as well.
You must remember though, that the second package sees the first package
as its "parent" and, should you deactivate the first package without
deactivating the second package, BOTH will be deactivated.
Heres an example.
Original Function
function Armour::BlaBla1 (%this,%obj)
{
echo("Dum de Dum Dum");
}
package TestPak1
{
function Armour::BlaBla1 (%this,%obj)
{
echo("id like to punch you in the.....");
parent::BlaBla1 (%this,%obj);
}
};
package TestPak2
{
function Armour::BlaBla1 (%this,%obj)
{
echo("Go and ..... yourself.");
parent::BlaBla1 (%this,%obj);
}
};
If both packages are activated you would get the followign output:
Go and ..... yourself.
id like to punch you in the.....
Dum de Dum Dum
if the second package is deactivated you would get
id like to punch you in the.....
Dum de Dum Dum
If both packages were activate and the first package was deactivated you
get
Dum de Dum Dum
What can and cannot be included in a package
It is important to know what you can and cannot include in a package. A
package may ONLY contain functions. It may not contain datablocks,
variables or function calls. These may, or course, be contained within
functions within the package, but not directly in the package.
ie. This will give a line error:
package TestPak1
{
$TestVal =3D 1;
function Armour::BlaBla1 (%this,%obj)
{
echo("id like to punch you in the.....");
parent::BlaBla1 (%this,%obj);
}
};
whereas this is fine:
package TestPak1
{
function Armour::BlaBla1 (%this,%obj)
{
$TestVal =3D 1;
echo("id like to punch you in the.....");
parent::BlaBla1 (%this,%obj);
}
};
Summary:
Packages are a very powerful tool and should be used, especially for mod
creation. Lorne said yesterday, "Its almost like cheating". I agree,
it is almost too easy. Watch me cheat

Wizard_TPG
wizardsworld@bigpond.com"