Permanent attachments. This class is for things that are described in the story text as attached to one another, but which can never be separated. This is a mix-in class that can be combined with a Thing subclass.

Descriptions of attachment tend to invite the player to try detaching the parts; the purpose of this class is to provide responses that are better than the defaults. A good custom message for this class should usually acknowledge the attachment relationship, and explain why the parts can't be separated.

There are two ways to express the attachment relationship.

First, the more flexible way: in each PermanentAttachment object, define the 'attachedObjects' property to contain a list of the attached objects. All of those other attached objects should usually be PermanentAttachment objects themselves, because the real-world relationship we're modeling is obviously symmetrical. Because of the symmetrical relationship, it's only necessary to include the list entry on one side of a pair of attached objects - each side will automatically link itself to the other at start-up if it appears in the other's attachedObjects list.

Second, the really easy way: if one of the attached objects is directly inside the other (which often happens for permanent attachments, because one is a component of the other), make the parent a PermanentAttachment, make the inner one a PermanentAttachmentChild, and you're done. The two will automatically link up their attachment lists at start-up.

Note that this is a subclass of Attachable. Note also that a PermanentAttachment can be freely combined with a regular Attachable; for example, you could create a rope with a hook permanently attached, but stil allow the rope to be attached to other things as well: you'd make the rope a regular Attachable, and make the hook a PermanentAttachment. The hook would be unremovable because of its permanent status, and this would symmetrical prevent the rope from being removed from the hook. But the rope could still be attached to and detached from other objects.

class PermanentAttachment :   Attachable

Superclass Tree   (in declaration order)


Subclass Tree  


Global Objects  


Summary of Properties  


Inherited from Attachable :
attachedObjects  attachmentLister  majorAttachmentLister 

Summary of Methods  


Inherited from Attachable :
attachTo  beforeTravel  canAttachTo  canDetachFrom  detachFrom  dobjFor(AttachTo)  dobjFor(Detach)  dobjFor(DetachFrom)  dobjFor(TakeFrom)  examineStatus  explainCannotAttachTo  getNonPermanentAttachments  handleAttach  handleDetach  initializeThing  iobjFor(AttachTo)  iobjFor(DetachFrom)  iobjFor(TakeFrom)  isAttachedTo  isListedAsAttachedTo  isListedAsMajorFor  isMajorItemFor  isPermanentlyAttachedTo  mainMoveInto  maybeHandleAttach  maybeHandleDetach  moveWhileAttached  travelWhileAttached 



basic message to use when we try to detach something from self


cannotDetachMsgFor (obj)OVERRIDDENextras.t[3587]

Get the message explaining why we can't detach from 'obj'.

By default, if our container is also a PermanentAttachment, and we're attached to it, we'll simply return its message. This makes it really easy to define symmetrical permanent attachment relationships using containment, since all you have to do is make the container and the child both be PermanentAttachments, and then just define the cannot-detach message in the container. If the container isn't a PermanentAttachment, or we're not attached to it, we'll return our default library message.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3