About this time last year, ya’ll helped me put together some broken chair legs to make a ladder. Well now, I need to break the ladder apart because it’s too big to move into the fireplace.
The PC can assemble the parts after they’re inside the fireplace.
I can detach the pieces again, which is fine albeit a little tedious. And it seems like I have to do this in a particular order. So for the sake of simplicity, I was hoping a Doer “break ladder” would return the three pieces back into individual objects.
From the previous post, I did end up swapping a new ladder object for the assembled pieces, FYI
Here is the doer. I will be happy to include the entire ladder section if that would help.
When I execute the command, the output is below and it seems the ladder is still blocking travel, even though it is no longer in my inventory.
Thank you in advance!
Doer 'break ladder'
execAction(c)
{
"You break the ladder down into its three former sections. ";
ladder.moveInto(nil);
leg1.moveInto(me);
leg2.moveInto(me);
leg3.moveInto(me);
leg1.detachFrom(location);
//leg1.actionMoveInto(gActor);
//leg3.detachFrom(leg2);
//leg3.actionMoveInto(gActor);
leg2.ladderAssembled = nil;
}
;
I’m not sure whether this is the source of the problem, but I notice that in the statement
leg1.detachFrom(location);
Your code doesn’t specify which object’s location property you mean, so it would refer to the Doer’s location property, which presumably isn’t what you mean. You probably don’t mean leg1’s location either, since by the time this statement is executed, this would be me.
I don’t know what else is going on in other parts of your code, but the statement leg1.detachFrom(location); won’t actually do anything, since it’s effectively equivalent to leg1.detachFrom(nil);legi1 will therefore remain attached to whatever it was attached to before, and if that was the ladder, that could be the source of your problem.
What’s interesting is that the library still has the three leg sections attached to each other. So when I tried to add them back, it was throwing an error because only the final leg that was attached to the other two needs to be called. And I have no way of knowing which leg section that will be.
Now I’m thinking that changing the vocab is a better route, maybe.
I’ll do some more testing.
Thank you!
If you want to end up with all three legs not attached to anything the easiest way may be to do something like:
for(local cur in [leg1, leg2, leg3])
{
cur.attachments = [];
cur.attachedToList = [];
/* Then to have each leg carried by the player character: */
cur.moveInto(gPlayerChar);
}