I have 3 sections of broken chair legs that can be attached together to make a ladder.
Once they’re attached together, I would like to be able to refer to the new object as a ladder.
Because the PC then needs to climb the ladder.
I’m not sure how to go about renaming the newly assembled object. It seems like it takes on the name of the last attached object. I tried to add a globalParamName to all three objects as “ladder” but that doesn’t seem to have any effect.
Have you considered replacing the three chair legs with a separate ladder object when they’re assembled? That is, in the action handler where the legs are assembled, swap out the three legs for a ladder object. Something like this:
action() {
"You snap the final leg into place, creating a makeshift ladder. ";
ladder.moveInto(brokenLegs.location);
brokenLegs.moveInto(nil);
}
Then, you can give ladder the appropriate vocabulary, description, action handlers, etc.
Jim Nelson’s suggestion would be my first one too, but if you want to change the vocabulary of an object you can do so by calling replaceVocab(newvocab) on the object in question, e.g.,
This would rename the main object as ‘ladder’ and allow it to be referred to as ‘ladder’ by the player, who would also be able to refer to it as ‘broken chair leg’ or ‘wooden ladder’.
An alternative approach would be to use the altVocab and useAltVocabWhen properties on the chair leg in question, e.g.:
dunno if is better or not, but another handling of the former broken legs is adding an appropriate unthing to the action.
mulling around, swapping thing and unthing perhaps is also a good implementation of dismountable items ? sorry for being again a mil/Nav historian, tripod+really deadly weapon = active, armour-piercing, deadly weapon and vice/versa. (cue: the movie Thunderbolt and Lightfoot)…
Thank you all for your help. I’m still not quite there.
section1: SimpleAttachable 'wide chair leg; broken wooden chair leg;bottom' @diningRoomCastle
"The leg is wide and flat at one end and slightly narrower at the other end. "
bulk = 6
;
section2: SimpleAttachable 'long chair leg; broken wooden chair leg;middle' @diningRoomCastle
"A chair leg with three rungs sticking out, evenly spaced and horizontal to each other. "
allowableAttachments = [section1, section3]
ladderAssembled = section1.isAttachedToMe && section3.isAttachedToMe ? true : nil
altVocab ='ladder; wooden broken chair; leg'
useAltVocabWhen = ladderAssembled
bulk = 6
;
section3: SimpleAttachable 'narrow chair leg; broken wooden chair leg;top' @sittingRoom
"A chair leg with one rung on each side. "
bulk = 6
;
>attach narrow chair leg to long chair leg
You attach the narrow chair leg to the long chair leg.
>attach wide chair leg to long chair leg
(first taking the wide chair leg)
You attach the wide chair leg to the long chair leg.
>l
dining room
The dining room is sparsely furnished with a table and two chairs.
You can see a long broken chair leg here.
The simpleAttachable class makes it really easy to assemble the parts, however! And I probably should have mentioned that I was using that to begin with.