§10.10. Magic (Breaking the Laws of Physics)

Every previous section of this chapter have been about adding further realism constraints to Inform, to give it a more advanced understanding of physics (and chemistry). But Inform has plenty of physical laws built into it already, even if they are more mundane: inanimate objects do not spontaneously move or change, one solid object cannot pass through another, there are opaque barriers through which light cannot pass, and so on. These rules stop many attempted actions. (GO EAST - "The oak door is closed." GET EMERALD - "You can't, since the glass display case is in the way.")

In the real world, physics is not negotiable. ("Gravity: it's not just a good idea, it's the law.") But in stories, magic can sometimes happen, and in these examples some of the rules built into Inform are waived in special circumstances, which in effect cancel certain physical laws. Very many other magical tricks could be achieved: if you want to make a given command work despite realism constraints, try typing ACTIONS - a testing command which reveals what is happening behind the scenes - and then typing the command you want. This should reveal which named rule is stopping it: you can then try suspending that rule, and seeing if the effect now works.

* See Magic Words for ways to create new single-word spell commands


arrow-up.pngStart of Chapter 10: Physics: Substances, Ropes, Energy and Weight
arrow-left.pngBack to §10.9. Heat
arrow-right.pngOnward to §10.11. Mathematics

*ExampleMagneto's Revenge
Kitty Pryde of the X-Men is able to reach through solid objects, so we might implement her with special powers that the player does not have...

*ExampleInterrogation
A wand which, when waved, reveals the concealed items carried by people the player can see.

*ExampleTransmutations
A machine that turns objects into other, similar objects.

If somebody tries to walk through a closed door, the "can't go through closed doors rule" usually stops them. This is a rule belonging to the "check going" rulebook. These names are fairly explanatory when written out, but hard to remember: fortunately we don't need to remember them, as the Index panel contains a full inventory of the check, carry out and report rules for every action, showing all of their names and the order in which they are checked. (We can also find out which rules are stopping an action by typing the testing command ACTIONS.)

Here we make the rule do nothing provided a condition holds:

paste.png "Access All Areas"

The extremely difficult door is north of the Standing Room and south of the Room of Walking Upside Down. It is a locked door.

The player is carrying the Pointy Hat of Liminal Transgression. The hat is wearable.

The can't go through closed doors rule does nothing when the Hat is worn.

Test me with "n / wear hat / n".

(The Pointy Hat may be useful in debugging a game, even if it never makes it into the final published work.)

*ExampleAccess All Areas
The Pointy Hat of Liminal Transgression allows its wearer to walk clean through closed doors.

If somebody tries to walk through a closed door, the "can't go through closed doors rule" usually stops them. This is a rule belonging to the "check going" rulebook. These names are fairly explanatory when written out, but hard to remember: fortunately we don't need to remember them, as the Index panel contains a full inventory of the check, carry out and report rules for every action, showing all of their names and the order in which they are checked. (We can also find out which rules are stopping an action by typing the testing command ACTIONS.)

Here we make the rule do nothing provided a condition holds:

paste.png "Access All Areas"

The extremely difficult door is north of the Standing Room and south of the Room of Walking Upside Down. It is a locked door.

The player is carrying the Pointy Hat of Liminal Transgression. The hat is wearable.

The can't go through closed doors rule does nothing when the Hat is worn.

Test me with "n / wear hat / n".

(The Pointy Hat may be useful in debugging a game, even if it never makes it into the final published work.)