1

I want to create a skill that's a simple game, where first the user launches the skill with its invocation name and then Alexa asks a question, "Shall I roll the dice?" If the user answers "Yes," it rolls the dice, and says the result. Then Alexa asks again, "Shall I roll the dice?" If "Yes," do the same thing. This is the main loop I'm talking about, and it'll continue until the user answers "No" or "Quit" to this question.

I just can't figure out how to add the loop, or where it should go. I've looked at tutorials and videos and whatnot and just nothing I've found mentions a loop which I find really odd. But I'm a noob at this.

Any help would be awesome. I've been wanting to do this skill for so long but just am stuck on this loop thing.

clamum
  • 1,237
  • 10
  • 18

1 Answers1

1

I recommend you to take some time to understand how a skill work and then I recommend you to develop a quiz skill from this doc

You will then have a better understanding of how a request is made to Alexa service and how a response is returned. The logic behind Intent, how does a slot work, ...

An Alexa Skill is like a card game. The player can select any card at any time. Each card has its own function and is triggered by a voice.

So when the skill first asks the user for Shall I roll the dice?, the user will say either yes or no.

If the user says yes, it will then go to your AMAZON.YesIntent, If the user says no, it will then go to your AMAZON.NoIntent.

But you also need to make sure that the user can also say:

  • Stop > Amazon.StopIntent
  • Anything else, such as, cheese > FallbackIntent

By doing the quiz skill cited above, you will understand how to build your interaction model effectively.

A loop is straightforward. If the user replies yes, then in your intent handler for AMAZON.YesIntent, you will need to trigger the same function that will inject, in the response builder the prompt: Shall I roll the dice ?.

Keep in mind that a user can also ask to repeat. Imagine a skill being a personal assistant. It's not a voice mail. There are many other ways to say Shall I roll the dice? to not sound like a robot. Try implementing different response values possible to have a great customer experience overall.

callmemath
  • 8,185
  • 4
  • 37
  • 50
  • 1
    Yeah I probably should do a tutorial again; I had done all that quite a while ago when I was first working on it but the way you work on skills now is quite a bit different than when I first started, although the principles are the same. I'll give that a shot and see if I can figure it out from there. I really appreciate the helpful post. Also will definitely accept different response values and probably use a different prompt, I was just using a simple example to explain. – clamum Oct 28 '21 at 13:26
  • I ended up using the blueprint (I think that's what they're called; this was a year ago) for the High-Low Game and just modified it to fit my skill. There's no way in heck I would've ever figured out how to do that just on my own. i've been a software developer for 14 years, and while I'm not an expert, I think I'm above average. And I'm way too dumb to do Alexa Skills, wow. Shelved that project cause I'm too stupid to figure out how to make my skill free for a week and then ask for payment to unlock. Learning Kotlin/Compose (coming from Java) is actually do-able, I'll stick with that lol. – clamum Oct 13 '22 at 07:13