Tell the main events with the past simple, and step back to an earlier event with had + the past participle.
The main events, and the earlier one
Matilda: By the time the bus came, I had finished my coffee.
Lani: Lucky you. Mine went cold.
Not "By the time I called, the shop closed." — say "By the time I called, the shop had closed.". For the earlier event, step back with had + the past participle.
Try it: Yasmin: Did you catch your train on Friday? Choose Ethan's reply. (No. When I got to the platform, it had left. / No. When I got to the platform, it left.) Answer: No. When I got to the platform, it had left. — The train went before you arrived, so use had left, while "left" means it went as you arrived.
The background, in progress
For a longer action in progress behind the main event, use was / were + the -ing form.
Matilda: What were you doing when I called your name?
Lani: I was looking for my notes.
Try it: Hiroshi: Why didn't you answer my call last night? Choose Mei's reply. (Sorry, I was cooking when you called. / Sorry, I cooked when you called.) Answer: Sorry, I was cooking when you called. — The cooking was already going on when the call came, so use was cooking.
Earlier, and going on a while
For an earlier action that went on for some time before a past moment, use had been + the -ing form.
Lani: We had been talking for an hour when the session ended.
Matilda: It felt like ten minutes.
Not "When help arrived, they were waiting for an hour." — say "When help arrived, they had been waiting for an hour.". An earlier action that lasted up to a past moment takes had been + -ing.
Try it: Diego: Was Mateo annoyed when you finally got there? Choose Camila's reply. (Yes. He had been waiting for an hour. / Yes. He was waiting for an hour.) Answer: Yes. He had been waiting for an hour. — An hour of waiting before you arrived takes had been waiting.
What are the common mistakes?
Incorrect
Correct
Why
By the time I called, the shop closed.
By the time I called, the shop had closed.
For the earlier event, step back with had + the past participle.
When help arrived, they were waiting for an hour.
When help arrived, they had been waiting for an hour.
An earlier action that lasted up to a past moment takes had been + -ing.