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

#1 2013-01-08 15:20:34

shanecadigan
New Scratcher
Registered: 2013-01-08
Posts: 2

Script for sprite to pick the name of a kid from my class at random?

Hi can anyone help me with writing the script so that when i click the sprite it will pick a name of a child from my class at random. I have seen it done before where the cat says maybe i pick john or shane or mary. No i pick Jessica.  Thank You

Offline

 

#2 2013-01-08 15:26:42

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Script for sprite to pick the name of a kid from my class at random?

Just put all the names of the kids in your class into a list and pick randomly from that list:
http://i45.tinypic.com/2d7zx1.gif
You can have as many or as few entries in the list as you want, just replace the "Name" entries with the names of kids in your class, and add or remove as many of those blocks as you need.

Last edited by Kileymeister_test (2013-01-08 15:27:30)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#3 2013-01-08 17:08:42

shanecadigan
New Scratcher
Registered: 2013-01-08
Posts: 2

Re: Script for sprite to pick the name of a kid from my class at random?

Thank You for your help.

Offline

 

#4 2013-01-08 17:11:33

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Script for sprite to pick the name of a kid from my class at random?

Kileymeister_test wrote:

Just put all the names of the kids in your class into a list and pick randomly from that list:
http://i45.tinypic.com/2d7zx1.gif
You can have as many or as few entries in the list as you want, just replace the "Name" entries with the names of kids in your class, and add or remove as many of those blocks as you need.

alternately, you can just use

item (any v) of [kids in the class v]


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#5 2013-01-09 14:06:13

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Script for sprite to pick the name of a kid from my class at random?

zammer990 wrote:

Kileymeister_test wrote:

Just put all the names of the kids in your class into a list and pick randomly from that list:
http://i45.tinypic.com/2d7zx1.gif
You can have as many or as few entries in the list as you want, just replace the "Name" entries with the names of kids in your class, and add or remove as many of those blocks as you need.

alternately, you can just use

(item (any v) of [kids in the class v])

The "any" option isn't 100% random, but it would probably be OK here.

Offline

 

Board footer