How to check if two or more values are similar in array

#1

hi, so i been stuck on this for a while so maybe one of you can point how to approach this, i develop a OF app that activates some videos when a series of buttons are press via OSC when the video finish they are suppose to go back to a intro scene and wait for the next interaction, my issue comes when a user only press maybe one or two of the buttons then the app never goes back to the intro scene i can only make them come back when they press all the buttons so my approach until now is to try to store the states of each video in a array of bools
like this

void ofApp::videoStatus(){
 for (unsigned int  i = 0; i < players.size(); i++)
    {
        if (players[i].getIsMovieDone() ==true)
        {
            players[i].stop();

            stado[i] =true;
        }
        
    }

and then my idea is to check if there are more than one similar value in the array so if there is they go back to intro scene like this

void ofApp::compareStatus(bool _stado[],int size){
    int i,j;
    printf("Repeating numbers are");
    for ( i = 0; i < size; i++)
    {
        for ( j = i+1; j < size; j++)
        {
            if (_stado[i] == _stado[j])
            {
                cout<< _stado[i]<< " ";
               //cout<<" mas de dos videos se acabaron"<<endl;
            }
            
        }
        
    }
    
}

but if i do this it will set back to intro scene if the user took some time in pressing all the buttons has someone develop something similar how can i can make it wait for a while before resetting, should i use timers? maybe im overthinking this to much ?

#2

I don’t entirely understand what you want the behavior to be like, exactly, and it sounds like maybe you haven’t thought through exactly what you want it to do, either.

If you want a situation to result in a reset, but only after some time, then yes, I would record the time when the situation was detected, and then have the reset happen when the current time tCurrent == tSituation + tDelay.

Since it is about videos, however, maybe what you want is to reset when all of the videos have finished playing?