Adv3Lite -- Pressing a button

Hi,

So I’m a bit flustered trying to fix a parser response. An alpha tester tried pressing a button using a specific syntax. So in trying to debug this, I’ve run into a scenario that has me perplexed. Please consider this short snippet of working code and the resulting script file: [code]testRoom : Room ‘The Test Room’
south = blackDoor
;

  • statue: Thing ‘bronze statue’
    "A bronze statue. There is a black button at the top. "
    ;

  • Button, Fixture ‘black button’ // I’ve tried nesting the button in the statue to see if there would be different results; nope.
    "A black button is affixed to the top of the statue. "
    ;
    [/code]Here’s the transcript, my comments with *[code]>look

The Test Room

I can see a bronze statue here.

x statue
A bronze statue. There is a black button at the top.

x button
A black button is affixed to the top of the statue.

press button
Click!

press the button
Click!

press button on statue
I see no button on the bronze statue.

press the button on statue
I see no button here. (* the word ‘the’ is the difference)

press button on the statue
I see no statue here. (* ditto)

(*Now try PUSH instead of PRESS)

push button
Click!

push the button
Click!

push button on statue
(push button in statue)
I can’t push anything into the bronze statue.

push the button on statue
(push the button in statue)
I can’t push anything into the bronze statue.

push button on the statue
(push button in the statue)
I can’t push anything into the bronze statue.

press button on floor
Click!

push button on floor
Click![/code]Ideally, the result of press button should be the same for press button on statue, press the button on statue and press button on the statue. All three scenarios return different responses.

Push button is another story, but one thing at a time!

Any guidance would be greatly appreciated.

Thanks,
– Mike

This may not be the absolute best option, but I’m still new to TADS programming as well. Tried this out, and it seems to work.

What I did was make the statue a surface, made the button a component of the statue. Added a bit of code to stop players from putting things on the statue.

+ statue: Surface 'bronze statue'
    "A bronze statue. There is a black button at the top. "
    
    // Stop the player from putting things on the statue.
    iobjFor(PutOn)
    {
        verify()
        {
            illogical('Statues are not for resting things on. ');
        }
    }
;

++ Component, Button 'black button'
    "A black button is affixed to the top of the statue. "
;

This will allow the player to type “press button on the statue”

Thanks!

In my real WIP the item is also a container which caused some conflicts initially.

But your solution got me back on the right path and all is well.

Thanks for your help!

– Mike

Glad I could help.