Lately I've been walking through the Buttons Trivia Skill, which is a jump from the Color Buttons skill in size and complexity.
Thank you to the team that put the Trivia Skill together! It's really helpful to have a working set of code to walk through. I feel like I'm spelunking in a newly found cave in this code base. The structures are so far from the factskill and trivia skills that I extended off of that even working my way through it is taking some time. It has excellent encapsulation; much better than my skills do, but that also means more jumping around when trying to figure out what's going on. The debug logging is really helpful on this front! I'm starting to understand what's going on here. I've followed it through a roll call.
Here are a few things that were helpful for me, in case they're helpful to you:
- The skill is using 1.0.25 of the AWS SDK, not the new 2.x.
- The skill roughly starts with the NewSession handler in handlers/startHandlers.js
- emit('handlerName') calls that handler... I wasn't using this at all but it seems like that's being pushed in the AWS SDK these days.
- GlobalResponseReady in index.js is called every time the skill is about to return something to the user. The shouldEndSession is deleted here for gadgets if the skill is not expecting a vocal response.
- All the dialog is stored in dialog/uiprompts.js in full JSON objects
- Short circuit evaluation is being used in variable assignment
- To build a button response we use parts from all over:
- The GameEngine and GadgetController are objects in utils/directives.js and that's where you'll find all the start stop & set functions
- The animations are set up in config/settings.js
- Those animations are build by functions in button_animations/animations.js
- GlobalResponseReady keeps the session open for gadget input
Has anyone else been working with this sample? What have you found interesting?