void main()
{
  int nEventNumber = GetUserDefinedEventNumber();
  object oBar = GetNearestObjectByTag("WP_Bar");
  object oPatron = GetLocalObject(OBJECT_SELF,"LastPatron");
  int nBusy = GetLocalInt(OBJECT_SELF,"Busy");

  switch(nEventNumber)
  {

    case 1001: //OnHeartbeat
      if (nBusy == 0)
      {
        SetLocalInt(OBJECT_SELF,"Busy",1);
        int nRandom = d8();
        oPatron = GetNearestObjectByTag("suderham_cit",OBJECT_SELF,nRandom);
        SetLocalObject(OBJECT_SELF,"LastPatron",oPatron);
        ActionMoveToObject(oPatron);
        ActionSpeakString("What can I get for you?");
        ActionWait(2.0f);
        ActionMoveToObject(oBar);
        int nOrder = d3();
        string sOrder;
        switch (nOrder)
        {
          case 1:
            sOrder = "I need two glasses of wine.";
            break;
          case 2:
            sOrder = "A shot of whiskey for my friend.";
            break;
          case 3:
            sOrder = "Give me a mug of ale.";
            break;
        }
        ActionSpeakString(sOrder);
        ActionWait(2.0f);
        ActionMoveToObject(oPatron);
        ActionSpeakString("There you go.");
        ActionWait(2.0f);
        ActionDoCommand(SetLocalInt(OBJECT_SELF,"Busy",0));
      }
      break;

  }

}
