5. Want to Buy a… (intermediate)

About this example

In this example, a user can purchase mysterious intergalactic navigation items from a shop on a limited budget, showing a basic approach to e-commerce in conversation bots. Note the careful spacing of random number assignments, which occur on a per-interaction basis, according to current limitations.

Cleverscript preview

5-Want-to-Buy-a

Cleverscript downloads

Download XLS
Download TSV

Techniques to look out for

  • Random number, $random_number$ [3.4]
  • Day of week, time_day_of_week$ [3.4]
  • Tracking money with basic arithmetic [3.5]

Suggested scripting practice

  • Track the shopkeeper’s inventory, and how many of each item a user has purchased.
  • Allow a special deal (discount or combination) depending on the day of the week.

← Rock Paper Scissors                                                            Finite State Machine →

Leave a Reply