tl;dr
I want to figure out a way to queue up a list of strings while a piston is running. In Javascript terms…I’d like a way to push() and shift() the list of strings. Add to the end, and pull from the front.
Long version:
I’m more than happy to figure out the rest of the piston on my own. I can do the majority of it no problem. The main thing I am hung up on is pushing and shifting the array.
If this isn’t possible, then I suppose the alternative is to just keep an index…The loop just keeps going further and further into the queue…when it reaches the end, it just cleans out the list and sets the index back to zero, assuming there’s an easy way to clear out a string list variable. If there isn’t…I suppose the next option would be to set values to blank after they are pulled. And the loop is set to not do anything if the next item in the list is blank.
If I can figure out these two things, I think I can get everything else done:
When Adding / Pushing to the list:
I’m assuming I will have to use some sort of expression to check the length of the string list, add one, and then append the string?
When Pulling / Shifting from the list:
Here is where I’m stuck…I can’t figure out an option to shift the array…aka, pull the first item, and shift everything else forward.
For those curious, here is what I’m trying to accomplish:
I have pretty terrible ADHD. I usually have a list of things I know I need to get done, I just get distracted with other things. So to stay on task, I want to try out an idea using WebCoRE, IFTTT and Echo Speaks…
Basic Idea…I tell Google to add a chore to my list. Then Alexa announces that chore every 5 minutes, until I hit a button saying it’s done. Then Alexa moves onto the next item in the list and starts announcing that every 5 minutes.
(I’m using both Google Assistant and Alexa because I hate having to say “Alexa Trigger BLAH”. Whereas the Google Assistant trigger with IFTTT lets you customize whatever you want, with 3 different phrasings for 1 action, and a custom response)
The process may end up being more than one piston. But here is what the process would be…
I tell Google Assistant “queue up take out the trash” (or something like that)
IFTTT will have an applet saying:
IF (Google Assistant receives phrase "queue up $")
THEN (Webhook request to WebCoRE, containing "$" string in arguments)
The piston will take the string and append it to the end of the string list
There will be a loop that runs every X minutes…it will Speak() on my Echo device the most recent string it pulled from the string list.
It will continue Speaking this string every X minutes until I push a button, which will then tell it to move onto the next string.
My research progress (also for my own personal reference when looking back on this post):
Currently reviewing: Implementing a Queue
Info on how to clear an array while testing: Deleting an array element