Contingency

Contingency was an evocation spell that allowed a caster to set a trigger for another stored spell.

Effect
Contingency stored a spell for a long time, ranging from days in older versions to ten days in newer versions. The spell would be triggered to start after set conditions, like the start of a battle or being under water. The spell could not contain very powerful spells, and older versions would have a spell based on the caster's ability. After the Second Sundering, the spell changed to carry a spell slightly less powerful then the contingency spell.

The spell trigger had to be specific but general, like being underwater or falling more then a specific distance. If the trigger was too complicated, then it could fail. The spell would always trigger if conditions were met, whether the caster wanted it to or not.

Only one contingency spell could be active at any time, if cast again it would replace the old one.

Components
The older version of the spell used 100 gold pieces worth of quicksilver; a small part of a spell-using creature like the eyelash of an ogre mage, for example; and a statue of the caster carved from elephant ivory and decorated with gems. The newer versions only needed the carved and bejeweled statuette of the caster, which had to be worth at least 1,500 gold pieces.

Realmslore
The wizard Parwyyd Hanifar employed a contingency with a fire shield spell to protect himself against sudden attack, even whilst distracted or deep in thought, such as when Onyx the Invincible rushed at him in the Year of the Prince, 1357 DR and was suddenly met with flames.