//Ready messages
IfSpawned
  tmpargument = 0
  IfContentIs
    tmpargument = 3
    SetContent
    
//Maybe the character identifies the gem?
IfUsed
  SetTargetToWhoeverIsHolding
  tmpargument = 75
  SetReloadTime
  tmpargument = selfcontent
  SendMessageNear
  
  tmpx = selfcontent
  tmpy = 8
  IfXIsLessThanY
    tmpargument = selfcontent + 1
    SetContent
  Else
    tmpargument = 3
    SetContent
  
//Poof!
IfCrushed
  SpawnPoof
  SpawnPoof
  tmpargument = 1
  SendMessageNear
  
// Set up general stuff
IfSpawned
  tmpargument = ACTIONJB
  DoAction
  KeepAction
  MakeCrushValid

// Make it lie on the floor
IfDropped
  KeepAction

// Play a clink or clang
IfHitGround
  tmpargument = 0
  PlaySound

// Alert others to draw
IfTakenOut
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 2
    SendMessageNear

// Tell them what they've won...
IfGrabbed
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 0
    SendMessageNear

// Finish up
End
