CollectiveGroup class | objects.t[1123]

A "collective group" object. This is an abstract object: the player doesn't think of this as a physically separate object, but rather as a collection of a bunch of individual objects. For example, if you had a group of floor-number buttons in an elevator, you might create a CollectiveGroup to represent the buttons as a collection - from the player's perspective, there's not a separate physical object called "the buttons," but it might nonetheless be handy to refer to "the buttons" collectively as a single entity in commands. CollectiveGroup is designed for such situations.

There are two ways to use CollectiveGroup: as a non-physical, non-simulation object whose only purpose is to field a few specific commands; or as a physical simulation object that shows up separately as an object in its own right.

First: you can use a CollectiveGroup as a non-physical object, which essentially means it has a nil 'location'. The group object doesn't actually appear in any location. Instead, it'll be brought into the sensory system automatically by its individuals, and it'll have the same effective sensory status as the most visible/audible/etc of its individuals. This choice is appropriate when the individuals are mobile, so they might be scattered around the game map, hence the group object might need to be invoked anywhere. With this option, you normally won't want to make the CollectiveGroup handle very many commands, because you'll have to completely customize each command you want it to handle, in order to properly account for the possible scattering of the individuals. For example, if you want the group object to handle the TAKE command, you'll have to figure out which individuals are in reach, and specially program the procedure for taking each of the available individuals.

Second: you can use CollectiveGroup as a simulation object, and actually set its 'location' to the location of its individuals. The group object in this case shows up in the simulation alongside its individuals. This is a good choice if the individuals are fixed in place, all in one place, because you can simply put the group object in the same location as the individuals without worrying that the individuals will move around the game later on. This is much easier to handle than the first case above, mostly because commands that physically manipulate the individuals (such as TAKE) aren't a factor. In this set-up, you can easily let the group object handle many actions, since it won't have to do much apart from showing the default failure messages that a Fixed would generate in any other situation. Note that if you use this approach, the CollectiveGroup should *also* inherit from Fixture or the like, so that the group object is fixed in place just like its corresponding individuals.

The parser will substitute a CollectiveGroup object for its individuals when (1) any of the individuals are in scope, (2) the CollectiveGroup has vocabulary that matches a noun phrase in the player's input, and (3) the conditions for substitution, defined by isCollectiveQuant and isCollectiveAction, are met.

(The substitution itself is handled in two steps. First, an individual will add the group object to the sense connection list whenever the individual is in the connection list, which will bring the object into scope, so the parser will be able to match the vocabulary from the group object any time an individual is in scope. Once the group object is matched, its filterResolveList method will throw out either the group object or all of the individuals, depending on whether or not the isCollectiveQuant and isCollectiveAction tests are met.)

For example, we might have a bunch of coins and paper bills in a game, and give them all a plural word 'money'. We then also create a collective group object with plural word 'money'. We set the collectiveGroup property of each coin and bill object to refer to the collective group object. Whenever the player uses 'money' in a command, the individual coins and bills will initially match, and the group object will also match. The group object will then either throw itself out, keeping only the individuals, or will throw out the individuals. If the group object decides to field the command, it will be the only matching object, so a command like "examine money" will be directed to the single collective group object, rather than directed to the matching individuals one at a time. This allows the game to present simpler, more elegant responses to commands on the individuals as a group.

By default, the only action we handle is Examine. Each instance must provide a suitable description so that when the collective is examined, we describe the group of individuals appropriately.

`class CollectiveGroup : Thing`

Superclass Tree (in declaration order)

`CollectiveGroup`
`Thing`
`VocabObject`
`object`

Subclass Tree

`CollectiveGroup`
`ItemizingCollectiveGroup`

Global Objects

(none)

Summary of Properties

`isListedInContents isListedInInventory isPlural`

Inherited from `Thing` :
`actorInAName actorInName actorInPrep actorIntoName actorOutOfName actorOutOfPrep aDisambigName allStates aName brightness bulk canBeHeard canBeSeen canBeSmelled canBeTouched canMatchHer canMatchHim canMatchIt canMatchThem circularlyInMessage collectiveGroup collectiveGroups contents contentsListed contentsListedInExamine contentsListedSeparately contentsLister descContentsLister described disambigEquivName disambigName distantDesc distantInitSpecialDesc distantSpecialDesc distinguishers dummyName effectiveFollowLocation equivalenceKey equivalentGrouper equivalentGrouperClass equivalentGrouperTable esEndingPat explicitVisualSenseInfo getState globalParamName holdingIndex iesEndingPat initDesc initNominalRoomPartLocation initSpecialDesc inlineContentsLister isEquivalent isHer isHim isInInitState isKnown isLikelyCommandTarget isListedAboardVehicle isMassNoun isProperName isQualifiedName isThingConstructed isTopLevel listName listWith location lookInLister moved name nameDoes nameSays nameSees notTravelReadyMsg objectNotifyList objInPrep obscuredInitSpecialDesc obscuredSpecialDesc owner patElevenEighteen patIsAlpha patLeadingTagOrQuote patOfPhrase patOneLetterAnWord patOneLetterWord patSingleApostropheS patTagOrQuoteChar patUpperOrDigit patVowelY pluralDisambigName pluralName pronounSelector roomDarkName roomLocation roomName seen sightPresence sightSize smellPresence smellSize soundPresence soundSize specialContentsLister specialDesc specialDescBeforeContents specialDescListWith specialDescOrder specialNominalRoomPartLocation suppressAutoSeen takeFromNotInMessage theDisambigName theName theNamePossNoun tmpAmbient_ tmpAmbientFill_ tmpAmbientWithin_ tmpFillMedium_ tmpObstructor_ tmpObstructorWithin_ tmpPathIsIn_ tmpTrans_ tmpTransWithin_ touchPresence touchSize verbCan verbCannot verbCant verbEndingSD verbEndingSEd verbEndingSMessageBuilder_ verbMust verbToCome verbToDo verbToGo verbToLeave verbToSay verbToSee verbWill verbWont weight`

Inherited from `VocabObject` :
`canResolvePossessive disambigPromptOrder pluralOrder vocabLikelihood vocabWords weakTokens`

Summary of Methods

`addToSenseInfoTable expandPronounList filterResolveList getVisibleIndividuals isCollectiveAction isCollectiveQuant specialPathFrom`

Inherited from `Thing` :
`acceptCommand addAllContents addDirectConnections addObjectNotifyItem addToContents adjustLookAroundTable adjustThrowDestination afterAction afterTravel allContents aNameFrom aNameObj aNameOwnerLoc announceDefaultObject appendHeldContents atmosphereList baseMoveInto basicExamine basicExamineFeel basicExamineListen basicExamineSmell basicExamineTaste beforeAction beforeTravel buildContainmentPaths cacheAmbientInfo cacheSenseInfo cacheSensePath canBeHeardBy canBeSeenBy canBeSensed canBeSmelledBy canBeTouchedBy canDetailsBeSensed canHear canMatchPronounType canMoveViaPath cannotGoShowExits cannotReachObject cannotSeeSmellSource cannotSeeSoundSource canOwn canSee canSmell canThrowViaPath canTouch canTouchViaPath checkActorOutOfNested checkBulkChange checkBulkChangeWithin checkMoveViaPath checkStagingLocation checkThrowViaPath checkTouchViaPath checkTravelerDirectlyInRoom childInName childInNameGen childInNameWithOwner childInRemoteName clearSenseInfo cloneForMultiInstanceContents cloneMultiInstanceContents conjugateRegularVerb connectionTable construct contentsInFixedIn countDisambigName countListName countName countNameFrom countNameOwnerLoc darkRoomContentsLister defaultDistantDesc defaultObscuredDesc desc directionForConnector distantSmellDesc distantSoundDesc dobjFor(AskAbout) dobjFor(AskFor) dobjFor(AskVague) dobjFor(AttachTo) dobjFor(Attack) dobjFor(AttackWith) dobjFor(Board) dobjFor(Break) dobjFor(Burn) dobjFor(BurnWith) dobjFor(Clean) dobjFor(CleanWith) dobjFor(Climb) dobjFor(ClimbDown) dobjFor(ClimbUp) dobjFor(Close) dobjFor(Consult) dobjFor(ConsultAbout) dobjFor(CutWith) dobjFor(Detach) dobjFor(DetachFrom) dobjFor(Dig) dobjFor(DigWith) dobjFor(Doff) dobjFor(Drink) dobjFor(Drop) dobjFor(Eat) dobjFor(Enter) dobjFor(EnterOn) dobjFor(Examine) dobjFor(Extinguish) dobjFor(Fasten) dobjFor(FastenTo) dobjFor(Feel) dobjFor(Flip) dobjFor(Follow) dobjFor(GetOffOf) dobjFor(GetOutOf) dobjFor(GiveTo) dobjFor(GoThrough) dobjFor(JumpOff) dobjFor(JumpOver) dobjFor(Kiss) dobjFor(LieOn) dobjFor(Light) dobjFor(ListenTo) dobjFor(Lock) dobjFor(LockWith) dobjFor(LookBehind) dobjFor(LookIn) dobjFor(LookThrough) dobjFor(LookUnder) dobjFor(Move) dobjFor(MoveTo) dobjFor(MoveWith) dobjFor(Open) dobjFor(PlugIn) dobjFor(PlugInto) dobjFor(Pour) dobjFor(PourInto) dobjFor(PourOnto) dobjFor(Pull) dobjFor(Push) dobjFor(PushTravel) dobjFor(PutBehind) dobjFor(PutIn) dobjFor(PutOn) dobjFor(PutUnder) dobjFor(Read) dobjFor(Remove) dobjFor(Screw) dobjFor(ScrewWith) dobjFor(Search) dobjFor(Set) dobjFor(SetTo) dobjFor(ShowTo) dobjFor(SitOn) dobjFor(Smell) dobjFor(StandOn) dobjFor(Strike) dobjFor(Switch) dobjFor(Take) dobjFor(TakeFrom) dobjFor(TalkTo) dobjFor(Taste) dobjFor(TellAbout) dobjFor(TellVague) dobjFor(Throw) dobjFor(ThrowAt) dobjFor(ThrowDir) dobjFor(ThrowTo) dobjFor(Turn) dobjFor(TurnOff) dobjFor(TurnOn) dobjFor(TurnTo) dobjFor(TurnWith) dobjFor(TypeLiteralOn) dobjFor(TypeOn) dobjFor(Unfasten) dobjFor(UnfastenFrom) dobjFor(Unlock) dobjFor(UnlockWith) dobjFor(Unplug) dobjFor(UnplugFrom) dobjFor(Unscrew) dobjFor(UnscrewWith) dobjFor(Wear) examineListContents examineListContentsWith examineSpecialContents examineStatus failCheck feelDesc fillMedium findOpaqueObstructor findTouchObstructor forEachConnectedContainer forEachContainer fromPOV getAllForTakeFrom getAllPathsTo getAnnouncementDistinguisher getBagAffinities getBagsOfHolding getBestDistinguisher getBulk getBulkWithin getCarryingActor getCommonContainer getCommonDirectContainer getConnectedContainers getConnectorTo getContentsForExamine getDestName getDropDestination getEncumberingBulk getEncumberingWeight getExtraScopeItems getHitFallDestination getIdentityObject getInScopeDistinguisher getListedContents getLocPushTraveler getLocTraveler getMovePathTo getNoise getNominalDropDestination getNominalOwner getObjectNotifyList getOdor getOutermostRoom getOutermostVisibleRoom getRoomNotifyList getRoomPartLocation getStateWithInfo getStatuslineExitsHeight getThrowPathTo getTouchPathTo getTravelConnector getVisualSenseInfo getWeight hasCollectiveGroup hideFromAll hideFromDefault initializeEquivalent initializeLocation initializeThing inRoomName iobjFor(AttachTo) iobjFor(AttackWith) iobjFor(BurnWith) iobjFor(CleanWith) iobjFor(CutWith) iobjFor(DetachFrom) iobjFor(DigWith) iobjFor(FastenTo) iobjFor(GiveTo) iobjFor(LockWith) iobjFor(MoveWith) iobjFor(PlugInto) iobjFor(PourInto) iobjFor(PourOnto) iobjFor(PutBehind) iobjFor(PutIn) iobjFor(PutOn) iobjFor(PutUnder) iobjFor(ScrewWith) iobjFor(ShowTo) iobjFor(TakeFrom) iobjFor(ThrowAt) iobjFor(ThrowTo) iobjFor(TurnWith) iobjFor(UnfastenFrom) iobjFor(UnlockWith) iobjFor(UnplugFrom) iobjFor(UnscrewWith) isActorTravelReady isComponentOf isDirectlyIn isHeldBy isIn isInFixedIn isListed isListedInContents isListedInInventory isListedInRoomPart isLookAroundCeiling isNominallyIn isNominallyInRoomPart isOccludedBy isOrIsIn isOwnedBy isShipboard isVocabEquivalent itIs itNom itObj itPossAdj itPossNoun itVerb listCardinality localDirectionLinkForConnector lookAround lookAroundPov lookAroundWithin lookAroundWithinContents lookAroundWithinDesc lookAroundWithinName lookAroundWithinSense lookAroundWithinShowExits lookInDesc mainExamine mainMoveInto mapPushTravelHandlers mapPushTravelHandlers mapPushTravelHandlers mapPushTravelHandlers mapPushTravelHandlers meetsObjHeld mergeSenseInfo mergeSenseInfoTable moveInto moveIntoForTravel moveIntoNotifyPath mustMoveObjInto nameIs nameIsnt nameVerb normalizePath notePromptByOwnerLoc notePromptByPossAdj noteSeenBy notifyInsert notifyMoveInto notifyMoveViaPath notifyRemove obscuredDesc obscuredSmellDesc obscuredSoundDesc pluralNameFrom processThrow propHidesProp propWithPresent putInName receiveDrop remoteDesc remoteInitSpecialDesc remoteRoomContentsLister remoteSpecialDesc removeFromContents removeObjectNotifyItem restoreLocation roomActorThereDesc roomContentsLister roomDaemon roomDarkDesc roomDesc roomFirstDesc roomRemoteDesc roomTravelPreCond saveLocation selectPathTo sendNotifyInsert sendNotifyRemove senseAmbientMax senseInfoTable senseObj sensePathFromWithin sensePathFromWithout sensePathToContents sensePathToLoc sensePresenceList setAllSeenBy setContentsSeenBy setGlobalParamName setVisualSenseInfo shineFromWithin shineFromWithout shineOnContents shineOnLoc showDistantSpecialDesc showDistantSpecialDescInContents showInventoryContents showInventoryItem showInventoryItemCounted showListItem showListItemCounted showListItemCountedGen showListItemGen showObjectContents showObscuredSpecialDesc showObscuredSpecialDescInContents showRemoteSpecialDesc showRemoteSpecialDescInContents showSpecialDesc showSpecialDescInContents showSpecialDescInContentsWithInfo showSpecialDescWithInfo showStatuslineExits showWornItem showWornItemCounted smellDesc smellHereDesc soundDesc soundHereDesc specialDescList statusName stopThrowViaPath superHidesSuper tasteDesc thatNom thatObj theNameFrom theNameObj theNameOwnerLoc theNameWithOwner throwTargetCatch throwTargetHitWith throwViaPath transmitAmbient transSensingIn transSensingOut traversePath tryHolding tryImplicitRemoveObstructor tryMovingObjInto useInitDesc useInitSpecialDesc useSpecialDesc useSpecialDescInContents useSpecialDescInRoom useSpecialDescInRoomPart verbEndingEs verbEndingIes verbEndingS verbToHave verbWas verifyFollowable verifyInsert verifyMoveTo verifyRemove whatIf whatIfHeldBy withVisualSenseInfo`

Inherited from `VocabObject` :
`addToDictionary getFacets inheritVocab initializeVocab initializeVocabWith matchName matchNameCommon matchNameDisambig throwNoMatchForLocation throwNoMatchForPossessive throwNothingInLocation`

Properties

`isListedInContents` | `objects.t[1349]`

CollectiveGroup objects are not normally listable in any situations. Since a collective group is merely a parser stand-in for its individuals, we don't want it to appear as a separate object in the game.

`isListedInInventory` | `objects.t[1350]`

no description available

`isPlural` OVERRIDDEN | `objects.t[1125]`

collective group objects are usually named in plural terms

Methods

`addToSenseInfoTable (sense, tab)`OVERRIDDEN | `objects.t[1287]`

When we have no location, we're an abstract object without any physical presence in the game world. However, we still want to show up in the senses to the same extent our individuals do. To do this, we override this method so that we use the same sense data as the most visible (or whatever) of our individuals.

`expandPronounList (typ, lst)`OVERRIDDEN | `objects.t[1217]`

"Unfilter" a pronoun antecedent list. We'll restore the individuals to the list so that we can choose anew, for the new command, whether to select the group object or the individuals.

For example, suppose there's a CollectiveGroup for a set of elevator buttons that handles the Examine command, but no other commands. Now suppose the player types in these commands:

>examine buttons
>push them

On the first command, the CollectiveGroup object will filter out the individual buttons in filterResolveList, because the group object handles the Examine command on behalf of the individuals. This will set the pronoun antecedent for IT and THEM to the group object, because that's the program object that handled the action. On the second command, if the player had typed simply PUSH BUTTONS, the collective group object would have filtered *itself* out, keeping the individuals. However, the raw pronoun binding for THEM is the group object; if we did nothing to change this, we'd get a different response for PUSH THEM than we'd get for PUSH BUTTONS. That's where this routine comes in: by restoring the individuals, we let filterResolveList() make the decision about what to keep anew for the pronoun.

`filterResolveList (lst, action, whichObj, np, requiredNum)`OVERRIDDEN | `objects.t[1152]`

Filter a noun phrase resolution list.

If there are any objects in the resolution list for which we're a collective, we'll check to see whether we want to the collective or keep the individuals. We want to keep the collective if the action is one we can handle collectively; otherwise, we want to drop the collective and let the individuals handle the action instead.

Note that, when any of our individuals are in scope, we're in scope. This means that the collective is always in the resolution list, along with the individuals, if (1) any individuals are in scope, and (2) the vocabulary used in the noun phrase matches the collective object. If the vocabulary doesn't match the collective, the parser simply won't include the collective in the resolution list by virtue of the normal vocabulary selection mechanism, so we'll never reach this point.

By default, the collective object will be ignored if a specific number of objects is required. When the player explicitly specifies a quantity (by a phrase like "the five coins" or "both coins"), we'll assume they want to iterate over individuals rather than operate on the collection.

`getVisibleIndividuals (tab)` | `objects.t[1266]`

Get a list of the individuals that can be sensed, given the information table for the desired sense (for visible items, this can be obtained by calling gActor.visibleInfoTable()). This is a service routine that can be useful for purposes such as writing a description routine for the collective. For example, a "money" collective object might want to count up the sum of money visible and show that.

Note that it's possible for this to return an empty list. The caller can deal with this in a description, for example, by indicating that the collection cannot be seen.

`isCollectiveAction (action, whichObj)` | `objects.t[1233]`

Check the action to determine if it's one that we want to handle collectively. If so, return true; if not, return nil.

`isCollectiveQuant (np, requiredNum)` | `objects.t[1247]`

Check to see if we're a collective for the given quantity. By default, we return true only when no quantity is specified.

`specialPathFrom (src, vec)`OVERRIDDEN | `objects.t[1326]`

When we have no location, we want to create our own special containment path, just as we create our own special SenseInfo.

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