0 votes
by (290 points)
The question pretty much says it all and is not-unrelated to my earlier one. There does not appear to be a (hide:) macro. Is there some way to hide a hidden named passage that has been revealed through (show:)?

Thanks!

1 Answer

0 votes
by (159k points)
selected by
 
Best answer

There currently is no (hide:) macro, and you are not the first person to ask for one (Issue #86)

There are a number of ways you could implement this functionality yourself, but as suggested in the linked Issue the simplest is to use a (replace:) macro to empty the named hook's contents.

|fan)[The overhead fan spins lazily.]

(link:"Turn on fan")[\
(show: ?fan)\
(link: "Turn off fan")[(replace: ?fan)[]]\
]

... the above is based on the example supplied in the (show:) macro's documentation.

by (290 points)
Thanks, greyelf!
by (160 points)

Fan switch example is really intriguing. I was wondering if there is a similar method to repeatedly turn the fan on and off. With Greyelf's cool example above it works for just one cycle.

I put together my own solution for a Space Colony game I'm messing around with. It stretches over three pages (which is pretty cumbersome). It'd be great to try to use the new (hidden:) etc.

Passage 1

Resarch Topic Contents

(display: "openrt")

Passage 2, "openrt"

|openrt>[Research Topic]
		(click-replace: ?openrt)[\
			Research Topic
			
			(display: "rti")\
			]

Passage 3, "rti"

<!-- Research Topic Information-->
This contains useful information contained inside the Research Topic.

(display: "closert")

Passage 4, "closert"

{
|rtbl>[<<]\
	(click-replace: ?rtbl)[\
		(replace: ?openrt)[\
			Research Topic
			]
		(click-replace: ?openrt)[\
			Research Topic
			
			(display: "rti")\
			]
		]
}

 

by (300 points)

If you want it to work both ways endlessly, as you have probably figured out by now, you would use the (replace:) macro for both ways.

For example:

[]<Light|
(link-repeat:"Turn on light")[(replace:?Light)[The light is on.]]
(link-repeat:"Turn off light")[(replace:?Light)[The light is off.]]

That's quite simple, but it works.

...