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

#1 2011-02-26 10:14:35

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

how do lists work?

I've been using scratch for about a year now, and I can't really figure out exactly what is list is or what it does or anything like that. Can somebody tell me what it is, because apparently that is how you make a saved game and I'm making a pokemon game that needs saving technology...

~gamer_6

Offline

 

#2 2011-02-26 10:19:57

TVflea
Scratcher
Registered: 2010-08-14
Posts: 1000+

Re: how do lists work?

right click on a block you don't understand and click help.


-iNetMaster-'s not dead, get used to it. ! big_smile .
http://is.gd/YrQzXX

Offline

 

#3 2011-02-26 11:16:21

mathematics
Scratcher
Registered: 2009-03-01
Posts: 1000+

Re: how do lists work?

Check it out in Scratch Wikibig_smile

Last edited by mathematics (2011-02-27 03:07:31)

Offline

 

#4 2011-02-26 11:42:08

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do lists work?

does anyone know how to make it save your game?

or how to make it do something like the items back from pokemon?

Offline

 

#5 2011-02-26 12:02:28

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do lists work?

sorry, items BAG not items back

i don't seem to be able to type correctly today...  sad

Offline

 

#6 2011-02-26 12:25:52

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: how do lists work?

Lists are basically lists that you can add, change and remove things to.
To use them to save a game you might do:

/When I receive [Save game]\
[Add (money) to [Save1]]
[Add (X position) to [Save1]]
[Add (Y position) to [Save1]]

And to load:

/When I receive [Save game]\
[Set [Money] to (Item (1) of [Save1])]
[Go to X: (Item (2) of [Save1]) Y: (Item (3) of [Save1]) ]

Offline

 

#7 2011-02-26 14:25:54

gamer_6
Scratcher
Registered: 2010-07-20
Posts: 20

Re: how do lists work?

cool i'm gonna try that

Offline

 

#8 2011-02-27 03:15:04

mathematics
Scratcher
Registered: 2009-03-01
Posts: 1000+

Re: how do lists work?

Scratch 1.4 Reference Guide wrote:

LISTS

You can create and manipulate lists in Scratch.  Lists can store numbers as well as strings of letters and other characters.
To create a list, go to the Variables blocks category and click http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/Make_List.gif. Once you make a list, several list blocks will appear. The list blocks are described in the Block Descriptions section of this guide.
When you create a list, a list monitor will appear on the stage. A list monitor shows all the items in a given list. You can type items directly into a list monitor.
At first the list will be empty, with length 0.  To add to the list, click the + button on the bottom left of the list monitor. The length will increase by 1. Alternatively, you can add to the list using the list blocks (e.g., http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/add_string_list_example.gif ).
You can resize the list monitor from the bottom right-hand corner.
Note: You can right-click (Mac: Ctrl+click) on a list monitor to export a list to a plain .txt file.  You can also import any saved plain .txt files with values on separate lines.

BLOCK DESCRIPTIONS

Variables

http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/Make_List.gif Allows you to create and name a new list. When you create a list, the blocks for that list will appear. You can choose whether the list is for all sprites (global) or just for one sprite (local).
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/delete-a-list.gif Deletes the blocks associated with the list.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/My_List_Box.gif Reports all the items in the list.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/Add_to_List.gif Adds the specified item to the end of the list. The item can be a number or a string of letters and other characters.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/delete-list.gif Deletes one or all items from a list. You can choose from the pull-down menu, or use a number to specify which item to delete. Choosing ?last? deletes the last item in the list. Choosing ?all? deletes everything from the list. Deleting decreases the length of the list.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/insert_list.gif Inserts an item at the specified position in the list. You can choose from the pull-down menu, or use a number to specify where to insert the item. Choosing ?last? adds the item to the end of the list. Choosing ?any? inserts at a random place in the list. The length of the list increases by 1.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/replace_list.gif Replaces an item in the list with the specified value. You can choose from the pull-down menu, or use a number to specify which item to replace. Choosing ?last? replaces the last item on the list. Choosing ?any? replaces a random item in the list. The length of the list does not change.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/item_list.gif Reports the item at the specifed position in the list. You can choose from the pull-down menu, or use a number to specify which item to report. Choosing ?any? reports a random item in the list.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/length_list.gif Reports how many items are in the list.
http://info.scratch.mit.edu/sites/infoscratch.media.mit.edu/images/ListContains.gif Reports true if the list contains the specified item. (The item must match exactly to report true.)

Offline

 

#9 2011-03-01 19:21:08

scratch256
Scratcher
Registered: 2011-02-18
Posts: 18

Re: how do lists work?

colorfusion wrote:

Lists are basically lists that you can add, change and remove things to.
To use them to save a game you might do:

/When I receive [Save game]\
[Add (money) to [Save1]]
[Add (X position) to [Save1]]
[Add (Y position) to [Save1]]

And to load:

/When I receive [Save game]\
[Set [Money] to (Item (1) of [Save1])]
[Go to X: (Item (2) of [Save1]) Y: (Item (3) of [Save1]) ]

Don't you mean When I recive Load game?


My first scrolling game is out!

Offline

 

#10 2011-03-06 13:35:43

fruitpunch
Scratcher
Registered: 2010-10-24
Posts: 1

Re: how do lists work?

is there any way to make a list show in a certain part of my program? like:

when I receive notepad:
show list notes


kinda like with variables when you can show and hide them.

Offline

 

#11 2011-03-06 13:39:07

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: how do lists work?

fruitpunch wrote:

is there any way to make a list show in a certain part of my program? like:

when I receive notepad:
show list notes


kinda like with variables when you can show and hide them.

This doesn't exist in Scratch 1.4, but it will be included in Scratch 2.0.  smile


Yawn.

Offline

 

#12 2011-03-06 13:43:26

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

Re: how do lists work?

meowmeow55 wrote:

fruitpunch wrote:

is there any way to make a list show in a certain part of my program? like:

when I receive notepad:
show list notes


kinda like with variables when you can show and hide them.

This doesn't exist in Scratch 1.4, but it will be included in Scratch 2.0.  smile

...Hopefully. Likely.  smile

Offline

 

Board footer