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
Check it out in Scratch Wiki!
Last edited by mathematics (2011-02-27 03:07:31)
Offline
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
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. 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.,).
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
VariablesAllows 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).
Deletes the blocks associated with the list.
Reports all the items in the list.
Adds the specified item to the end of the list. The item can be a number or a string of letters and other characters.
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.
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.
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.
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.
Reports how many items are in the list.
Reports true if the list contains the specified item. (The item must match exactly to report true.)
Offline
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?
Offline
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
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.
Offline
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.
![]()
...Hopefully. Likely.
Offline