One commonly used element in a story is the need to get something in order to do something. This works for both IF and games. The example below would be where a reader/player encounters a door that is locked. If they later find the key to this lock they can go back and unlock the door. Instead of a door/key combination, this could be easily modified for a number of other plot elements:
raised drawbridge / crank
candle / match
non-functioning airplane / gas
or even things like a dragon blocking your path/ magical sword to slay it.
All elements like the ones listed above are put into IFs as variables. Variables tell Twine what to do if a certain condition is fulfilled and (typically) what to do if it is not. In the case of a encountering a locked door (as shown in one of the subpages in this section), if you don't have the item (e.g., the key) you will get one message (e.g., This door is locked. Looks like you need to go find a key!) and something happens or doesn't happen (e.g., the door stays locked).
On the other hand, if you do you may get a different message (e.g., You try your key in the door and the locks clicks.) have the item happens (e.g. The door opens with an ominous creak.).