Carnivale
Suppose we want to make an object that (unlike a backdrop) is definitely located in one room, but can be seen from far off. We want to allow the player to interact with it from a distance, but only using those actions that require visibility. Other actions should be denied:
As the descriptions make clear, the ferris wheel should be visible from everywhere in the fair, so we'll borrow a line from the Activities chapter to make that happen:
"Scope" determines what the player can interact with; by writing this rule, we make Inform understand all commands that refer to the ferris wheel when the player is anywhere in the fairground, instead of responding with
as it normally would.
Now, by default, if the player were to type TOUCH FERRIS WHEEL while in another room, he would get the response
This may not be quite what we want, but we can replace this text with our own reaching inside rule:
And because our accessibility rules are considered before the "Instead" phase, we can write the following rule confident that it will apply only when the player is in fact in range to touch the ferris wheel:
Test me with "x ferris wheel / touch ferris wheel / se / x ferris wheel / touch ferris wheel".
You are now just inside the gates. Behind you snakes a triple line of fairgoers all the way down the length of the valley to the railway station. Roughly southeast of here is the ferris wheel, towering over the other attractions.
>(Testing.)
>[1] x ferris wheel
It is extravagantly tall and carries several dozen glass gondolas for riders.
>[2] touch ferris wheel
You can only look from this distance.
>[3] se
By the Wheel
You stand at the foot of an enormous ferris wheel, which turns far too quickly and never seems to stop for new riders.
>[4] x ferris wheel
It is extravagantly tall and carries several dozen glass gondolas for riders.
>[5] touch ferris wheel
You don't dare: it's spinning too fast.