How to Set Variables Defined in Code/GSheets?

Hey there! US (and Royal) Navy submariners have to practice a lotttttt of mental math. The quickest way to getting chewed out in front of everyone is goofing it up

Before VoiceFlow existed, I made an Alexa skill that allowed us to practice these skills at home. But I’m not a programmer and it’s kinda buggy. I want to port it over to VoiceFlow.

It’s a superrrrrr basic skill. Here are the requirements:

  1. There are 2 arrays of numbers. Randomly draw one number from each array (masthead height and division are the array names).

  2. Take each of these randomized numbers and run them through a math equation. The output of this equation is the range variable.

  3. Tell the user which value for the masthead height and divisons have been selected. Ask user what the answer to the range equation is.

  4. Compare user answer to value of range variable. If within some tolerance -> correct. If incorrect, tell user they are wrong.

  5. Repeat.

My questions for the VF community:

  1. How do I use the VF code block to declare a variable that can be called by the Speech block? This page in the VF documentation was not working: https://learn.voiceflow.com/build-alexa-skills-without-coding/using-logic/variables

  2. Would I use the code block to also compare the range variable to user’s answer?

  3. Alternatively, I could just put everything in a Google sheet (for the next level use case, there are some tricky equations involving time [minutes / seconds], that I’m not sure I can easily pull off). Are there are any challenges with just putting the arrays and the equations in a GSheet and pulling from there?

Thanks!

Jeff