samuri51 / chillybot

a turntable bot created by a moderator of straight_chillin11
12 stars 12 forks source link

Play limit #21

Open btburbank opened 11 years ago

btburbank commented 11 years ago

I was wondering if it could be enforced on a condition of that there must be 5 dj's on deck for the playlimit to be enforced. When there are less than 5 dj's on deck = no enforcement.

samuri51 commented 11 years ago

this is the standard play limit code plus two conditions added.

  1. in order for play limit to enforce there must be more than zero people in the queue
  2. must be 5 dj's on stage

this is what you meant?

 //iterates through the dj list incrementing dj song counts and
    //removing them if they are over the limit.
    var djId = data.room.metadata.current_dj;

    if (typeof (djs20[djId]) !== 'undefined')
    {
        if (++djs20[djId].nbSong >= playLimit)
        {
            if (PLAYLIMIT === true && queueList.length > 0 && currentDjs.length >== 5) //if play limit is on and no one is in queue
            {                                                                          //and greater than or equal to 5 dj's on stage
                if (djId == currentDjs[0] && playLimit === 1) //if person is in the far left seat and limit is set to one
                {
                    var checklist33 = theUsersList.indexOf(djId) + 1;
                    bot.speak('@' + theUsersList[checklist33] + ' you are over the playlimit of ' + playLimit + ' song');
                    bot.remDj(djId);
                }
                else if (djId != USERID && playLimit !== 1) //if limit is more than one
                {
                    var checklist33 = theUsersList.indexOf(djId) + 1;
                    bot.speak('@' + theUsersList[checklist33] + ' you are over the playlimit of ' + playLimit + ' songs');
                    bot.remDj(djId);
                }
            }
        }
    }
btburbank commented 11 years ago

Right. I've had less than 5 dj's on stage with no one in the q and it still escorts people.

samuri51 commented 11 years ago

well it shouldn't now... it was never setup to only escort when 5 dj's on stage in the first place

btburbank commented 11 years ago

Ok, so what do I need to change?

samuri51 commented 11 years ago

this code should work...

samuri51 commented 11 years ago

only activates when play limit is turned on, more than zero people in the queue and 5 dj's on stage. it also waits until it loop around the left side when the play limit is set to 1

samuri51 commented 11 years ago

its found in the endsong event at the very end of the file... you should see an old version of it in your file