This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-02-24 12:15:41

aaminor
New Scratcher
Registered: 2013-02-12
Posts: 14

How do I pick a random item from a list?

I'm making a hangman game, and I need for the script to randomly pick a word from a list of words.

HOWEVER, the player is asked how LONG of a word he/she wants beforehand. So, I need the script to randomly pick a word from the list that is a certain length long. How do I do this?

Offline

 

#2 2013-02-24 16:26:10

Gamefan888
Scratcher
Registered: 2009-05-17
Posts: 40

Re: How do I pick a random item from a list?

Well, you could try using a:

item (any) of [list]
(If that didn't work, I meant you can use a round block in the variable list section that says "item (any) of list".)

To get it to make sure to pick a word of the length you want, you should make different lists for different lengths of words.

I hope this helps! Oh, and please give me a link when you finish the hangman game - it sounds exciting!


Looking for a challenging platformer with great controls and well designed levels with a twist? Look no further! http://www.scratch.mit.edu/projects/Gamefan888/3111394

Offline

 

Board footer