Hi guys, how to exchange the locations of two objects in Inform 7?. Thanks,
You can use a few lines like these:
[code]“Magic Swap” by LB
The kitchen is a room.
The garage is a room. It is south of the kitchen.
The apple is thing in the kitchen.
The car is a thing in the garage.
Understand “swap [anything] with [anything]” as swapping it with.
Swapping it with is an action applying to two things out of world.
Carry out swapping it with:
let R1 be the location of the noun;
now the noun is in the location of the second noun;
now the second noun is in R1;
test me with “swap the apple with the car / look / swap the apple with the car / look”
[/code]
If you want that one of the objects appears in the container (or the supporter) where the other was and viceversa, the code is a bit more complicated, but you asked only to swap the locations, so the code above solves your problem