the-infocom-files/enchanter

Bedpost issues

Opened this issue · 4 comments

You can open the bedpost multiple times, and even when it's open, "OPEN BEDPOST" suggests it's not:

>PUSH BUTTON
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

>PUSH BUTTON
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

>OPEN BEDPOST
Maybe it can be opened, but it's unclear how.

>REZROV BEDPOST
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

These messages are handled by BEDPOST-BUTTON-F and BEDPOST-F.

Also, once you've taken the scroll "PUSH BUTTON" has no effect at all:

>PUSH BUTTON
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

>GET GOLD LEAF SCROLL
Taken.

>PUSH BUTTON

>CLOSE COMPARTMENT
Closed.

>PUSH BUTTON

>

That's because BEDPOST-BUTTON-F always handles the PUSH action, but doesn't necessarily print anything:

<ROUTINE BEDPOST-BUTTON-F ()
	 <COND (<VERB? PUSH>
		<FSET ,BEDPOST ,OPENBIT>
		<SETG SCORE <+ ,SCORE ,CHARM-POINT>>
		<SETG CHARM-POINT 0>
		<COND (<IN? ,CHARM-SCROLL ,BEDPOST>
		       <THIS-IS-IT ,CHARM-SCROLL>
		       <TELL ,POPS-OPEN CR>)>
		<RTRUE>)>>

It will still open the compartment, though.

The REZROV spell also behaves strangely:

>EXAMINE BEDPOST
A careful examination reveals a thin line which might well be the outline of a
small compartment, but the mechanism for opening it is not discernable.

>LEARN REZROV
Using your best study habits, you learn the rezrov spell.

>REZROV COMPARTMENT
You don't have the rezrov spell committed to memory!

>LEARN REZROV
Using your best study habits, you learn the rezrov spell.

>REZROV COMPARTMENT
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

By the way, if you REZROV the bedpost after taking the scroll, it prints "The bedpost pops open."

Unfortunately, it does this even if the bedpost is already open. But at least it's better than the empty message from "PUSH BUTTON".

This is what COMPARTMENT-F does:

<ROUTINE COMPARTMENT-F ()
	 <COND (<AND <NOT <IN? ,BEDPOST-BUTTON ,BED>>
		     <VERB? EXAMINE SEARCH>>
		<TELL
"A very thin line indicates that a hidden compartment might be imbedded
in the bedpost, but it's not clear how to open it." CR>)
	       (T
		<PERFORM ,PRSA ,BEDPOST>
		<RTRUE>)>>

So it looks like it should work. I think what happens here is that casting the spell on the compartment uses it up. Then it emulates a second casting on the bedpost, which also uses up one spell. Let's try that:

>SPELLS
The gnusto spell, the only thing you seem to have learned well after many years
at the University, remains yours forever. Other than that, you have the rezrov
spell thrice committed to memory.

>REZROV COMPARTMENT
The bedpost pops open, revealing a small compartment and, nestled inside, a gold
leaf scroll!

>SPELLS
The gnusto spell, the only thing you seem to have learned well after many years
at the University, remains yours forever. Other than that, you have the rezrov
spell once committed to memory.

Yup, it did use up the spell twice. That's not good.

The REZROV thing also happens in the Banquet Hall

>LEARN REZROV
Using your best study habits, you learn the rezrov spell.

>REZROV DECORATIONS
You don't have the rezrov spell committed to memory!

Because BANQUET-STUFF-F does this:

<ROUTINE BANQUET-STUFF-F ()
	 <COND (<AND <VERB? REZROV OPEN CLOSE LOOK-INSIDE EXAMINE>
		     <FSET? ,PRSO ,CONTBIT>>
		<FCLEAR ,PRSO ,CONTBIT>
		<PERFORM ,PRSA ,PRSO>
		<FSET ,PRSO ,CONTBIT>
		<RTRUE>)>>

But that's much less likely to trigger by accident, I think.

In Sorcerer, objects that redirect spells to other objects set the variable PERFORMING-SPELL to true first. That seems to be to keep the spell from being used up more than once.