
I haven't read your script in much detail, but just be aware, there is a different between type and class.
e.g.
"Argon Mercury Wheat trader" that is flying around in space, is a an object, of type Mercury (Tship_a_ts_001 or what ever, maintype x, subtype y)
And this type, happens to also be of class TS, which is of class transport ship, which is of class ship, which is a type of class movable object, which is of class object
An object is an actual thing, in space, that you can blow up (if it can die, its an object - there are some exceptions)
A type, is something category of objects, represented by a maintype and a subtype. e.g. maintype 11, subtype 0 represents energy cells
A class, is grouping of types or classes. (see pg 107 of the msci)
So you also have to be careful when you use things like
$FClass = $FShip -> get object class
As I'm fairly certain it returns the class, and not the type
(i.e. It will return TS, and not Argon Mercury maintype x subtype y)