World is described in a text file, or multiple text files. A global area for usable actions is described in the file, how a an action affects your characters health, movements, etc. e.g. drink drinks, eat food, etc.
If user types eat and there is no food in their bag, or current room then “no food is available” can be displayed.
Contents of the room, other people, usable items, directions you can go are all described in the file for each room you enter.
e.g.