void UpdateCookieSign(object oArea)
{
    // Define the tag of the sign.
    object oSign = GetObjectByTag("CAS_COOKIE_SIGN");

    // Make sure the sign is in the same area.
    if (GetArea(oSign) != oArea)
    {
        return;
    }

    // Initialize the message text for the board.
    string sMessage = "";

    // Iterate over all placeables tagged "CAS_COOKIE_PLATE" in the area.
    object oPlaceable = GetFirstObjectInArea(oArea);
    while (GetIsObjectValid(oPlaceable))
    {
        if (GetObjectType(oPlaceable) == OBJECT_TYPE_PLACEABLE && GetTag(oPlaceable) == "CAS_COOKIE_PLATE")
        {
            // Retrieve cookie type and number sold.
            string sCookieType = GetLocalString(oPlaceable, "sCOOKIE_TYPE");
            int iCookiesSold = GetLocalInt(oPlaceable, "iCookiesSold");

            // Create a message line for each type of cookie.
            if (sCookieType == "Dragon Cookies")
            {
                sMessage += "Moxie's Dragon Cookies Sold: " + IntToString(iCookiesSold) + " Cookies!\n\n";
            }
            else if (sCookieType == "Raspberry Thumbprint Cookies")
            {
                sMessage += "Circe's Raspberry Thumbprint Cookies Sold: " + IntToString(iCookiesSold) + " Cookies!\n\n";
            }
            // Add additional cookie types here as needed, with the extra \n\n.
        }
        oPlaceable = GetNextObjectInArea(oArea);
    }

    // Set the text on the sign.
    SetName(oSign, sMessage);
}

void main()
{
    // Get the object that triggered this event.
    object oPC = GetLastUsedBy();
    object oPlaceable = OBJECT_SELF;
    object oArea = GetArea(oPlaceable);

    // Check the cookie type.
    string sCookieType = GetLocalString(oPlaceable, "sCOOKIE_TYPE");

    // Increment the cookie sold count for this placeable.
    int iCookiesSold = GetLocalInt(oPlaceable, "iCookiesSold") + 1;
    SetLocalInt(oPlaceable, "iCookiesSold", iCookiesSold);

    // Update the cookie board sign in the area.
    UpdateCookieSign(oArea);
}
