Today I ran into a really wacky problem in I7 … so I thought, “Let’s see how T3 handles that.” This led me to discover an entirely different class of problem, but one that’s just as baffling. I have created three nails and attached them to a plank – but initially the descContentsLister senses and reports on four nails, not three.
Here’s the code:
class Nail: AttachableComponent
vocab = 'nail; iron sharp; spike'
desc = "You've seen nails before. "
dobjFor(Detach) {
verify() {}
}
dobjFor(DetachFrom) {
verify() {}
}
dobjFor(AttachTo) {
verify() {}
check() {
if (gIobj != plank) "You can't attach a nail to that. ";
else if (attachedTo == plank) "The nail is already attached to the plank. ";
}
}
;
lab: Room 'The Lab'
"A not entirely sterile room filled with bubbling retorts, oscilloscopes, and discarded
candy wrappers. "
+ me: Thing 'you'
isFixed = true
person = 2 // change to 1 for a first-person game
contType = Carrier
;
++ plank: NearbyAttachable 'plank; hefty wooden wood; board'
desc {"It's a hefty wood plank. "; }
//attachments = [nail_1, nail_2, nail_3]
iobjFor(DetachFrom) {
verify() {}
}
iobjFor(AttachTo) {
verify() {}
check() {
if (!gDobj.ofKind(Nail)) "You can't attach that to the plank. ";
else if (gDobj.attachedTo == plank) "The nail is already attached to the plank. ";
}
}
;
+++nail_1: Nail
attachedTo = plank
;
+++nail_2: Nail
attachedTo = plank
;
+++nail_3: Nail
attachedTo = plank
;
…and here’s the output:
>i
You are carrying a plank.
>x plank
It’s a hefty wood plank. You see four nails attached to the plank.
>detach nail
You detach the nail.
>x plank
It’s a hefty wood plank. You see three nails attached to the plank.
>detach nail from plank
You detach the nail.
>x plank
It’s a hefty wood plank. You see a nail attached to the plank.
You’ll notice that when the attachments list decrements from 2 items to 1 (1 remaining nail), the bug goes away. Looking at the Watch Expressions in Workbench using a breakpoint in descContentsLister, here’s what I’m seeing:
nail_3 is being listed twice. Bug in library? Probably. Suggestions on how to nuke it?