Need some help with this script. When I run this script it works well. However, at the end of the day it freezes at evening. The following day when I run the script it starts at evening, and it should start by saying morning. Am I missing something?
string timeOfDay;
dialog getTimeOfDay (out string TOD) {
string time = formatDate(now(), "HHmm");
if (time =~ '(?:[0-1]) (?:[0-1]) (?:[0-5]) (?:[0-9])'){
TOD = "morning";
}//Closes Morning String
elif (time =~ '(?:1) (?:[2-6]) (?:[-5]) (?:[0-9])') {
TOD = "afternoon";
}//Closes Afternoon String
else TOD = "evening";
call getTimeOfDay(out timeOfDay);