// ZZ> This function makes the button go down
// State 0 is ready to be pressed
// State 1 is draining
// State 2 is pressed button


GetWaterLevel
tmpx = tmpargument
tmpy = 850
IfXIsLessThanY
  // The button should be down, unable to be pressed
  IfStateIs0
    // The button is up...  Fix it
    tmpargument = ACTIONMG
    DoAction
      tmpargument = 2
      SetState
      KeepAction
      tmpargument = 0
      SetBumpHeight
Else
  // The button is up, ready to be pressed
  IfStateIs2
    // The button is down...  Pop back up
    tmpargument = ACTIONMJ
    DoAction
      tmpargument = 0
      SetState
      KeepAction
      tmpargument = 60
      SetBumpHeight


// Drain the water
IfStateIs1
  IfTimeOut
    // Drain complete
    tmpargument = 2
    SetState
    tmpargument = 1
    SendMessageNear
  Else
    // Change the level
    GetWaterLevel
    tmpargument = tmpargument < 6 - tmpargument + 450 > 6
    SetWaterLevel
    // Change the fog color...
    tmpturn = 0
    tmpdistance = tmpargument > 4
    tmpargument = tmpdistance > 1
    SetFogTAD



// Detect button press
tmpx = weight
tmpy = 20
IfXIsMoreThanY
  IfStateIs0
    tmpargument = ACTIONMG
    DoAction
      // Let 'em know
      KeepAction
      SetTargetToWhoeverBumped
      tmpargument = 0
      SetBumpHeight
      SendMessageNear
      tmpdistance = 11025
      PlaySound


      // Begin...
      tmpargument = 1
      SetState
      tmpargument = 150
      SetTime
End					// Finished with this character
