Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By : Michael Badger
Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By: Michael Badger

Overview of this book

Table of Contents (18 chapters)
Scratch 2.0 Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – importing fortunes to a list


Now, we'll see how easy it is to import an existing text file to a Scratch list called answers. You can use any answers you want, but I'm going to use a list of the common Magic 8-Ball responses available via Wikipedia at http://en.wikipedia.org/wiki/Magic_8_ball. My list will contain 20 answers to start.

Let's follow the given steps for importing fortunes to a list:

  1. Create a new list for the teller called answers.

  2. Build a plain text file with the answers you want to use in response to the seeker's questions. Enter one answer per line in a plain text editor. The following screenshot shows my list of answers. The book's source files will include a sample answers.txt file.

  3. To import the list, right-click on the answers list monitor and choose import. This will erase any items you previously added to the answers list.

  4. In the Import List dialog box, browse to the answers text file you saved on your computer prior to starting this exercise and select...