Simultaneous actions (al)

To express that two things happen at the same time—or that one action instantly triggers another—use al followed by an infinitive. This translates to "upon [doing something]" or "when [doing something]."

Upon opening the chest, you activate the trap.
Al abrir el cofre, activas la trampa.
Upon using the key, you unlock the portal.
Al usar la llave, desbloqueas el portal.

The verb following al stays in the infinitive. The sentence's main verb establishes the subject and tense.

Upon backing up, the boy used the shield.
Al retroceder, el niño usó el escudo.
Upon jumping the pit, she dropped the sword.
Al saltar el pozo, ella tiró la espada.

Direct object pronouns (like lo or la) for the main action behave normally, coming just before the conjugated verb.

Upon seeing the shield, you activate it.
Al ver el escudo, lo activas.
Upon seeing the enemy, you dodge him.
Al ver al enemigo, lo esquivas.