Random number generation is a fairly common "first app" test for people learning a language, often utilizing a dice roll as an easy to understand example with demonstrable results. This fits in easily with Tropo's capabilities, and can work on all networks (voice and SMS). We wrote an example app in each of the languages, and posted it up on our Github:
The application utilizes the random number generation functionality for each of the supported scripting languages, then creates an application that can roll a 6 sided die, a 20 sided die, flip a coin or throw rock, paper, scissors.
It implements the
onBadChoice event handlers, as well as defining an alternate route for text vs voice. Since an incoming text message is actually the activator for the application - the catalyst to get it going - rather than an answer to our question, we need to ignore it. The blank
ask handles that for us - but since the
[ANY] grammar is only viable for the text channel, we needed to split the app so a voice call wouldn't fail. Checking for a populated
initialText (which would hold the content of a text message) is an easy way to handle that.