Question about Speaking Random Text with Variables


#1

1) Give a description of the problem
I was looking at an example piston dealing with Random text to speech and wanted to borrow. I already have a morning routine that speaks the weather, but wanted to play around and really just wanted to know if it would work. I did not see any examples with Variables

2) What is the expected behavior?
Speak the weather with Random Greetings

3) What is happening/not happening?
So here is an example if what I’d like to try to use:

Random(“Good Morning . Here is your weather for {$dayOfWeekName}, {$monthName} {$day}. {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext}.”,“Good Morning Beautiful. Here is your weather for {$dayOfWeekName}, {$monthName} {$day}. {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext}. Have a great day.”,“Good Morning my wonderful wife. Here is your weather for {$dayOfWeekName}, {$monthName} {$day}. {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext}. Hope your day is as great as you are.”)

I think it should work, really just looking to see if others have used variables in the RANDOM along with speak text.


#2

I came up with a much better solution. Two lines one for the random greeting, and the second line for the weather report. But, I’m still interested in using variables with a random speech. It did not seem like it was returning anything in the expression window, which is what caused me to question.

Thanks


#3

I don’t think I was ever able to get variables to evaluate inside random().


#4

heres an example of random in a similar context:


#5

I could not seem to get random to work for speech, so I broke it up in to three sections, greeting, weather, closing. Only issue is that the speak text commands all run pretty much at the same time. I etither need to figure out how to do it all in one command, or wait until the other is complete. If both are possible, I’d like to know how, could be useful for future pistons.

here is what I have now


#6

I tried a wait between speak commands, it worked but was clunky so I went back to my initial goal. I believe this will work as I wanted. Hope others find this useful
The text itself is
{Random(“Good Morning Tracy.”,“Good Morning Beautiful.”,“Good Morning my wonderful wife.”," Good Morning my sexy lady.",“Good Morning.”)} Here is your weather for {$dayOfWeekName}, {$monthName} {$day}. {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext} {Random(“Have an Awesome Day.”,“Hope you have a good day at work.”,“Love you.”," I hope your day is as nice as you are.",“Wishing you a spectacular morning.”)}