All script commands, except for variable declarations, must be inside a begin-end block. Each time the script runs, each block will be evaluated to see if it is valid. If not, the script inside the block will not be run.

Example:

 begin GameMode 
Blocktype Parameters Description
GameMode This will be run every frame while the game is in non-menu mode. Most scripts will use this block type exclusively.
MenuMode MenuType (optional) Run every frame while the game is in menu mode.
OnActivate Run once when object is activated.
OnActorEquip ObjectID Run once when the scripted actor equips the specified object.
OnActorUnequip ObjectID Run once when the scripted actor unequips the specified object.
OnAdd ContainerRefID (optional) Run once when object is added to Container's inventory.
OnCombatEnd Run once when actor drops out of combat.
OnDeath ActorID (optional) Run once when actor is killed by ActorID
OnDestructionStageChange
OnDrop ContainerRefID (optional) Run once when object is dropped from Container.
OnEquip ActorID (optional) Run once when object is equipped by ActorID.
OnHit ActorID (optional) Run once when actor is hit by ActorID
OnHitWith ObjectID (optional) Run once when actor is hit by weapon ObjectID
OnLoad Run once when object's 3D is loaded
OnMagicEffectHit EffectID (optional) Run once when the actor is hit by the specified magic effect
OnMurder ActorID (optional) Run once when actor is murdered by ActorID
OnPackageChange PackageID Run once when actor changes from specified package
OnPackageDone PackageID Run once when actor completes specified package
OnPackageStart PackageID Run once when actor starts specified package
OnGrab Run once when the scripted object is grabbed by the player
OnRelease Run once when the scripted object is released from player grab
OnReset Run once when scripted object's cell is reset
OnSell SellerRefID (optional) Run once when object is sold by specified seller
OnStartCombat TargetActorID (optional) Run once when actor enters combat with TargetActorID
OnTrigger Run each frame something is triggering the object
OnTriggerEnter TriggeringRefID (optional) Run once when reference enters the trigger object
OnTriggerLeave TriggeringRefID (optional) Run once when reference leaves the trigger object
OnUnequip ContainerRefID (optional) Run once when object is unequipped by ActorID.
OnOpen Run once when the scripted container is opened.
OnClose Run once when the scripted container is closed.
SayToDone TopicID (optional) Run once when actor finishes saying a line of dialogue.
ScriptEffectStart Special block type used only by Magic Effect scripts
ScriptEffectFinish Special block type used only by Magic Effect scripts
ScriptEffectUpdate Special block type used only by Magic Effect scripts
OnFire Run once when the scripted weapon is fired (New Vegas only)
OnNPCActivate Run once when object is activated by an NPC (Untested; New Vegas only)
Function { Arguments (optional) } Special block type used only by User Defined Function scripts (NVSE only)


Note that for parameterized blocks, you can have several of the same block type using different parameters. For example, this script is valid:

 begin OnAdd 
    ; some script 
    ; this will run every time this object is added to someone's inventory 
 end 
 begin OnAdd player 
  ; some script 
  ; this will run every time this object is added to the player's inventory. 
  ; Note that the unparameterized OnAdd block will ALSO be run in this case. 
 end 
 begin OnAdd MysteriousChest 
  ; some script 
  ; this will run every time this object is added to the MysteriousChest's inventory. 
  ; Note that the unparameterized OnAdd block will ALSO be run in this case. 
 end