Processing a List


We want to have the character read all of the names from our players list. This is a very common type of problem when dealing with lists: we want to do the same thing for each item in the list. To tackle this problem, we are going to use a variable called index to keep track of the position of the element in the list we are processing.

Once you get the script above to work, try to make a script that will read all of the player names and then say them all together, with the appropriate commas, spaces, and the word “and,” as shown below. Remember to save your work!

List Output

Hint: Before you make the final result with the serial commas and the “and,” try to make a script that will just join together all the names into one variable, and then have it say that variable. The following block is a good starting point: