previous chapter contents page top page next chapter

SoftwarePackage

March 15, 1993last updated August 28, 1994

Defined in Package.Def 
Inherits from PackageRootList

Class Description

Every package must include a single object of class SoftwarePackage. This object provides information about the package to the system, such as the list of objects to install when the package is loaded, the package's ID and version number, and more.


Version note: Previous versions of the software called this class the MagicPackage class.

Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.

Using a SoftwarePackage Object

Whenever you create a package, you'll include an object of class SoftwarePackage to tell the system about your package. The software package object contains information that the system uses to load your package and to make it accessible to users.

The Software Package object includes a reference to the package's root list, which allows you to install sounds, colors, text styles, and other objects in the places reserved for them in the system. The Software Package object also allows you to install objects that don't have a system location, such as installing a door in the hallway.

You should create your package's Software Package object by starting with an existing one in text form and modifying it as necessary for your package.

Programming Information

Instantiate: often
Subclass: rarely
Call its methods: rarely

Every package should have exactly one Software Package object. You should never have to subclass or call any methods of this class.

Although Software Package objects have many fields, you'll only have to fill in a few of them for your package; most fields should set to zero or nil. In particular, you should set the installList and receivers fields to contain the IDs of your list of objects to be installed, and list of hosts for the installed objects, respectively. You should also fill in the citation field with a citation that identifies your package. The chapter on class Citation contains detailed instructions for creating citations.

Here's a sample SoftwarePackage object, taken from the puzzle sample code:

Instance SoftwarePackage 'Puzzle' 4;
         length: 32;
    dateCreated: 0;
    timeCreated: 0;
   dateModified: 0;
   timeModified: 0;
         author: iGeneralMagic;
    installList: (ObjectList 'Install' 43);
      receivers: (ObjectList 'Receiver' 44);
   installFlags: nilObject;
installParameters: nilObject;
 installTargets: nilObject;
   autoActivate: true;
       citation: (Citation 41);
      publisher: iGeneralMagic;
persistentShadowSize: 0;
persistentChangesSize: 0;
  transientSize: 0;
gotoActionSelector: 3.w;    // gotoSystemScene
         hidden: false;
   dontSaveData: false;
 copyOnActivate: false;
         entry1: nilObject; 
         entry2: nilObject; 
         entry3: nilObject; 
         entry4: nilObject;
         entry5: nilObject;
         entry6: (ObjectList 'Standard Places' 6);
         entry7: nilObject;
         entry8: nilObject;
         entry9: (ObjectList 'Objects With Help' 9);
        entry10: (ObjectList 'Help On Objects' 10);
        entry11: nilObject; 
        entry12: (Text 'About' 57);
        entry13: iGameRoomScene; 
        entry14: nilObject;
        entry15: (Image 'PuzzleIconImage' 56);
        entry16: nilObject;
        entry17: nilObject;
        entry18: nilObject;
        entry19: nilObject;
        entry20: nilObject;
        entry21: nilObject;
        entry22: nilObject;
        entry23: nilObject;
        entry24: nilObject;
        entry25: (TextField 'Display' 25);
        entry26: (ObjectList 'Text' 26); // list of our Strings
        entry27: (Image 'big bowser' 27); // the default puzzle image (can't 
be changed or deleted)
        entry28: nilObject;
        entry29: nilObject;
        entry30: nilObject;
        entry31: nilObject;
        entry32: nilObject;
End Instance;

Description of Attributes

Class SoftwarePackage defines the following attributes:

Attribute Type Description
Citation Citation the package's citation
Publisher AddressCard person or company who published the software
Hidden Boolean do not show in storeroom and friends
DontSaveData Boolean do not save the changes when the package (its card) goes >away
CopyOnActivate Boolean package's source cluster should be copied into locked persistent memory during activate
DontDeactivate Boolean this package should never be deactivated
HasClassImports Boolean true if there are class imports within this package;
corresponds with systemPackageReserved6 field
NeedsReset Boolean true if some class of the package requires Reset
Suicidal Boolean true if this package should be destroyed after installation; corresponds with systemPackageReserved7 field

The attributes correspond with similarly named fields except where noted.

Description of Fields

Class SoftwarePackage defines the following fields:

Field Type Description
Inherited from PackageRootList:
author AddressCard An address card for the author
installList ObjectList List of objects to be installed
receivers ObjectList List of objects to be installed into
installFlags FixedList Receiver-specific parameters that are not objects
installParameters ObjectList Receiver-specific parameters that are objects
installTargets Object Which packages to install into, and which version
autoActivate Boolean Install when loaded
Defined by SoftwarePackage:
citation Citation Helps identify package
publisher AddressCard Package's publisher
persistentShadowSize Unsigned Initial size of persistent cluster shadow
persistentChangesSize Unsigned Initial size of persistent cluster shadow changes
transientSize Unsigned Initial size of package transient cluster
gotoActionSelector Unsigned-Short Action to take when package is loaded
hidden Boolean Don't show in storeroom
dontSaveData Boolean Don't save data when card ejected
copyOnActivate Boolean Copy package's source cluster into locked persistent memory during activation
dontDeactivate Boolean
needsReset Boolean

Possible values for the gotoActionSelector field are:

Value Meaning
1 Show package scene
2 Open desk drawer
3 Show system scene

Package objects have a large number of extra data fields, each of which is a slot for a particular kind of package data. This table lists the extra fields and gives a brief description of what the system expects to find in each field.

Field Type Description
systemPackageReserved6 Boolean true if this package hasClassImports
systemPackageReserved7 Boolean true if this package should be destroyed after its installation
systemPackageReserved8 Boolean reserved for future use
systemPackageReserved9 Boolean reserved for future use
systemPackageReserved10 Boolean reserved for future use
systemPackageReserved11 Boolean reserved for future use
systemPackageReserved12 Boolean reserved for future use
systemPackageReserved13 Boolean reserved for future use
systemPackageReserved14 Boolean reserved for future use
systemPackageReserved15 Boolean reserved for future use
systemPackageReserved16 Boolean reserved for future use
entry1 for package TextStyles
entry2 for package Colors
entry3 for package Sounds
entry4
entry5 for package Prototypes
entry6 ObjectList for package StandardPlaces, such as our Scene
entry7 for package Fonts
entry8 for package Caches
entry9 ObjectList for package ObjectsWithHelp
entry10 ObjectList for package HelpOnObjects
entry11 for package Text
entry12 Text for package AboutInfo
entry13 Scene the system scene to go to if the goto selector is 3
entry14 for objects easily visible to other packages
entry15 ObjectList or Image for package images
entry16 for the package's about window
entry17 for the package's GuideBook
entry18 Scene for the package's Credits Scene
entry19 for package stationery
entry20 reserved by the system
entry21 reserved by the system
entry22 reserved by the system
entry23 reserved by the system
entry24 reserved by the system
entry25 unused
entry26 unused
entry27 unused
entry28 unused
entry29 unused
entry30 unused
entry31 unused
entry32 unused

You can use any of the unused entries for your own purposes. For example, you could fill in entry25 with an object list containing the package objects you want to make indexicals for.

Related Classes

Every package requires a citation. For a description of how to create citations for your packages, see the chapter on class Citation.

Method Descriptions

GoTo

operation GoTo(), safe, common, noFail

Call: sometimes
Override: rarely

Call GoTo to go to a package's contents. GoTo uses the package's gotoActionSelector to determine which scene or window to display. If the selector points to a corridor and the package has an entrance, it scrolls to the package's entrance.