********I modified this post so others can see what I wanted to do and how I accomplished it.*********
Original Post:
I want to have different responses based on the time of day. I feel like I have the logic right in my head, but my syntax is incorrect.
I want to compare the time of day, either morning, afternoon or evening and depending on what time is was the response would be either Good Morning, Good Afternoon and Good Evening.
Can I use the {time} then have it compare another variable? Thinking about it, the AM I could just test to see if the time has AM and I could do the AM logic. I think the {TIMEAMPM} would work nicely there. Then for afternoon and evening I would have to test the hole string.
****************************************
Solution:
This command is loaded anytime I load this profile. I wanted two things when I wrote this, I wanted the response to seem more AI like by knowing what time of the say it was. I only needed to know morning, afternoon and evening. First, I tested against the system time and retrieved the {TIMEAMPM} token so I could easily tell what part of the day it was. It would have been easier if we as humans didn't say afternoon and night, but we do so you have to account for that. Then it was a matter of splitting the time for PM how I wanted to designate afternoon and night(evening). Once I made my determination I setup the logic of 6pm using the {TIMEHOUR24} military time because it's just easier. Once it goes through the logic tree it ends with a "How can I assist you."
A few notes:
Write 'Good Evening' to log :: Lines like this can be removed, I just used them to trouble shoot my code and to make sure I was getting what I thought I should be getting.
Execute external plugin, 'MSCognitiveTextToSpeech - 1.0.7670.29377' using context 'Good Morning.' and wait for return :: This line is using the Microsoft Azure plugin to give me more realistic sounding voice. You have to setup and account in order to use it. The first 500K characters are free per month. So, to give that some perspective, the book "The Hobbit" is 95,000 words, if every word was 4-5 characters long that be close to 500K characters. I can't see myself using that many characters with this, but I will have to keep an eye on it if go crazy with responses.
I used this youtube video to get that setup.
https://www.youtube.com/watch?v=DvJ8FcthEO8One other thing to make note of, the very first line is
Stop VoiceAttack Listening. This profile I call Jarvis, so from all my other profiles when I say "Jarvis" it loads this profile and turns listening off. This profile I have a Prefix "Jarvis" that I have to say every time I use commands in this profile. Then when I go back to the other profile Listening is turned back on.
Stop VoiceAttack listening
Set integer [Time_Of_Day] value to the converted value of {TIMEHOUR24}
Begin Text Compare : [{TIMEAMPM}] Equals 'AM'
Execute external plugin, 'MSCognitiveTextToSpeech - 1.0.7670.29377' using context 'Good Morning.' and wait for return
Else If Text Compare : [{TIMEAMPM}] Equals 'PM'
Begin Integer Compare : [Time_Of_Day] Is Less Than 18
Execute external plugin, 'MSCognitiveTextToSpeech - 1.0.7670.29377' using context 'Good Afternoon.' and wait for return
Write [Blue] 'Good Afternoon' to log
Else If Integer Compare : [Time_Of_Day] Is Greater Than 18
Execute external plugin, 'MSCognitiveTextToSpeech - 1.0.7670.29377' using context 'Good Evening.' and wait for return
Write [Blue] 'Good Evening' to log
End Condition
End Condition
Execute external plugin, 'MSCognitiveTextToSpeech - 1.0.7670.29377' using context 'How can I assist you.' and wait for return