void NextGlow()
{
    object oArea = GetArea(OBJECT_SELF);
    string sMyTag = GetTag(OBJECT_SELF);
    string sMyNumber = GetStringRight(sMyTag, 2);
    int iMyNumber = StringToInt(sMyNumber);
    int iNextNumber;
    string sNextNumber;
    object oNextGlow;
    int bClockwise = TRUE;
    int bVerified = FALSE;
    int iSwitchbacks = 0;
        while (bVerified == FALSE){
            if (bClockwise == TRUE){iNextNumber = iMyNumber+1;
                if (iNextNumber > 16){iNextNumber = 01;}}
            if (bClockwise == FALSE){iNextNumber = iMyNumber-1;
                if (iNextNumber < 1){iNextNumber = 16;}}

            sNextNumber = IntToString(iNextNumber);
            if (iNextNumber < 10)
            {sNextNumber = "0"+sNextNumber;}
            oNextGlow = GetNearestObjectByTag("AWGLOWSTONE_"+sNextNumber);
            if (GetIsDead(oNextGlow) == FALSE){
                SetLocalInt(oNextGlow, "bActive", TRUE);
                SignalEvent(oNextGlow, EventUserDefined(1437));
                SetLocalInt(OBJECT_SELF, "bActive", FALSE);
                PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
                bVerified = TRUE;}
            //else if (GetIsDead(oNextGlow) == TRUE && iSwitchbacks < 2){
            //    if (bClockwise == TRUE)
            //    {bClockwise = FALSE;}
            //    else{bClockwise = TRUE;}
                //SetLocalInt(oArea, "bClockwise", bClockwise);
                //iSwitchbacks++;}
                }
                }

void main(){
    PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
    SetLocalInt(OBJECT_SELF, "bActive", TRUE);
    DelayCommand(1.0, NextGlow());}