// ZZ> This function makes an item fall to the floor when spawned
IfSpawned				//
  tmpargument = ACTIONJB		  //
  DoAction				  //
  KeepAction				  //
  MakeCrushValid
  MakeAmmoKnown
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 3
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 6
  SendMessageNear
IfDropped				// Make it lie on floor
  KeepAction				  //
IfHitGround				// Make a sound
  tmpargument = 0			  //
  tmpdistance = rand & 2047 + 10000	  //
  PlaySound				  //
IfInWater
  IfHeld
    GetState // NOP
  Else
    // Go blank
    GetContent
    tmpx = tmpargument
    tmpy = 0
    IfXIsEqualToY
      tmpargument = 1
      SetContent
      tmpargument = 5
      SendMessageNear
      MakeNameKnown      // To keep messages okay
IfGrabbed				// Tell them what they've won...
  SetTargetToWhoeverIsHolding		  //
  SetOwnerToTarget
  IfTargetIsAPlayer			  //
    GetContent
    SendMessageNear			  //
IfUsed
  GetContent
  tmpx = tmpargument
  tmpy = 0
  IfXIsEqualToY
    // The scroll has writing on it
    tmpargument = 1
    tmpdistance = rand & 2047 + 10000
    PlaySound


    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 0
    SpawnExactParticle


    SetTargetToWhoeverIsHolding
    tmpargument = 20
    SetTargetReloadTime
    IfNameIsKnown
      GetState
    Else
      tmpargument = 5
      tmpdistance = EXPSECRET
      GiveExperienceToTarget
    MakeSimilarNamesKnown


    // ID the opposite hand's item
    IfHeldInLeftHand
      tmpargument = 3
      SetTargetToTargetRightHand
        IdentifyTarget
          tmpargument = 2
    Else
      tmpargument = 3
      SetTargetToTargetLeftHand
        IdentifyTarget
          tmpargument = 2
    SendMessageNear
    tmpx = tmpargument
    tmpy = 2
    IfXIsEqualToY
      tmpargument = 5
      tmpdistance = EXPSECRET
      SetTargetToWhoeverIsHolding
      GiveExperienceToTarget
    CostAmmo
    IfAmmoOut
      GoPoof
  Else
    // Can't use a blank scroll...
    tmpargument = 0
    SetState
    tmpargument = 7
    SendMessageNear
    tmpargument = 50
    SetReloadTime
IfReaffirmed
  IfHeld
    GetState
  Else
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 3
    SpawnExactParticle
    SpawnExactParticle
    SpawnExactParticle
    SpawnExactParticle
    GoPoof
    tmpargument = 4
    SendMessageNear
End					// All done
