reversing directions

Is there a way to change the directional commands? I don’t mean substituting them with other words, but rather to make everything backwards? Here is an example of what I want to do after the player takes a particular object, although I know this text doesn’t actually work (the [the object] is not actually part of the text). I didn’t finish all the directions, but I’m sure you get the idea:

Carry out taking [the object]:
	now north is south;
	now northeast is southwest;
	now east is west;
	now southeast is northwest.

I checked the manual under 3.2, but I couldn’t seem to find anything regarding what I want to accomplish.

You’ll have to approach it from what the practical effect would be. If you want the player’s commands to do the opposite of what they typed, then:

Before going when the Particular Object is handled:
	if the noun is:
		-- north:
			now the noun is south;
		-- south:
			now the noun is north;
		-- east:
			now the noun is west;
		-- west:
			now the noun is east;
		[and so on]

I think that can be shortened up a bit, Juhana. There’s a built-in phrase "the opposite of " that should work generically.

Indeed, which would give you something like this.

Before going when [your conditions are met]: if the noun is a direction, now the noun is the opposite of the noun.

The check for “if the noun is a direction” prevents run-time problems if some other object got through to this stage of processing.

But you might not want to reverse in/out or up/down.


[code]Definition: a direction is nonplanar rather than planar if it is up or it is down or it is inside or it is outside.

Before going when [conditions]: if the noun is a planar direction, now the noun is the opposite of the noun.[/code]

excellent. thanks, all. does the same hold true for other actions? i.e. dropping/taking, sleep/wake, etc?

Unfortunately it does not. You’d have to write individual rules for each of those. But given the constraints in the standard rules (you can’t take something you already have, for instance) it might be cleaner to change the parsing.

Understand "drop [things]" as taking when [conditions]. Understand "take [things]" as dropping when [conditions].

No. The phrase “the opposite of” is defined specifically for directions. You’ll have to do it action by action (being careful to avoid infinite loops).

Reversed is a truth state that varies.
After reading a command: now reversed is false.

Instead of taking when reversed is false:
	now reversed is true;
	try dropping the noun.
Instead of dropping when reversed is false:
	now reversed is true;
	try taking the noun.

Edit: Draconis’s solution is neater.

omg. I can’t believe I didn’t think of that. Thanks, Draconis.