Creating a wardrobe with 3 drawers (TADS)

#1

I’m trying to make a wardrobe with three drawers. Something like this:

+wardrobe : ComplexContainer, OpenableContainer, Heavy ‘wardrobewardrobes’ ‘wardrobe’
"A simple wardrobe. Contains three drawers. "
subContainer : ComplexComponent, OpenableContainer { }
drawerU : ComplexComponent, OpenableContainer 'upper drawer
drawers’ ‘upper drawer’ { }
drawerM : ComplexComponent, OpenableContainer ‘middle drawerdrawers’ ‘middle drawer’ { }
drawerL : ComplexComponent, OpenableContainer 'lower drawer
drawers’ ‘lower drawer’ { }
;

…but this isn’t working. How to do it properly? Thank you in advance.

0 Likes

#2

Another question. Now I’m trying to create a few dynamic items and place them into the room:

initObject
{
execute ()
{
dyn.lw = new lwr;
dyn.lw.moveInto(startroom);

dyn.lw = new lwr;
dyn.lw.name = ‘ball’;
dyn.lw.noun = ‘ball’;
dyn.lw.desc = ‘A red ball.’;
dyn.lw.moveInto(startroom);
}
}

lwr: Thing, Wearable
name = ‘jeans’
noun = ‘jeans’
desc = "A pair of jeans. ";
;

dyn: object
lwr = nil
;

You see a jeans and a ball here.

x jeans
Which jeans do you mean, the ball, or the jeans?
get ball
The word “ball” is not necessary in this story.

What I’m doing wrong?

0 Likes

#3

Please enclose code in [code] [/code] tags (or indent every line with 4 spaces) to make it readable in the forum.

+wardrobe : ComplexContainer, OpenableContainer, Heavy 'wardrobe*wardrobes' 'wardrobe'
    "A simple wardrobe. Contains three drawers. "
    subContainer : ComplexComponent, OpenableContainer { }
    drawerU : ComplexComponent, OpenableContainer 'upper drawer*drawers' 'upper drawer' { }
    drawerM : ComplexComponent, OpenableContainer 'middle drawer*drawers' 'middle drawer' { }
    drawerL : ComplexComponent, OpenableContainer 'lower drawer*drawers' 'lower drawer' { }
;

The subContainer object is messing things up here. You can delete that (doesn’t look like you need it.)

However, the way you’ve set this up means the three drawers are inside the wardrobe, and they are not visible until you open the wardrobe. I don’t think this is what you want. You should probably make the three drawers just room fixtures. Make a new class:

class WardrobeDrawer: CustomFixture, OpenableContainer
    cannotTakeMsg = 'Better not remove the drawer from the wardrobe. ';
;

And then make the wardrobe a normal container and have the three drawers in the same room as the wardrobe:

+wardrobe: OpenableContainer, Heavy 'wardrobe' 'wardrobe'
    "A simple wardrobe with three drawers. "
;

+drawerU : WardrobeDrawer 'upper drawer*drawers' 'upper drawer'
;

+drawerM : WardrobeDrawer 'middle drawer*drawers' 'middle drawer'
;

+drawerL : WardrobeDrawer 'lower drawer*drawers' 'lower drawer'
;

With that being said, having complicated containers is (IMO) not a very good idea. It can be confusing to players :slight_smile:

0 Likes

#4

Can you delete that post and then create a new thread for this question, and with proper [code][/code] formatting? Thanks!

0 Likes