When there are two situations happened in the past. Using "Past Perfect Tense" with the situation that happened first and using Past Simple Tense with another situation.
She had gone already when I arrived.
He asked me whether I had been to China before.
John told me that he had waited for Marry for 2 hours.