diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 59e11853..57675d19 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -36,9 +36,10 @@ Module.register("compliments", { morningStartTime: 3, morningEndTime: 12, afternoonStartTime: 12, - afternoonEndTime: 17 + afternoonEndTime: 17, + random: true }, - + lastIndexUsed:-1, // Set currentweather from module currentWeatherType: "", @@ -147,8 +148,20 @@ Module.register("compliments", { * return compliment string - A compliment. */ randomCompliment: function() { + // get the current time of day compliments list var compliments = this.complimentArray(); - var index = this.randomIndex(compliments); + variable for index to next message to display + let index=0 + // are we randomizing + if(this.config.random){ + // yes + index = this.randomIndex(compliments); + } + else{ + // no, sequetial + // if doing sequential, don't fall off the end + index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed + } return compliments[index]; },