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

#1 2011-06-20 10:33:13

Galacta
Scratcher
Registered: 2009-09-23
Posts: 4

Variable list assistance

I am a decent scratcher who is working on an RPG. I am trying to create a variable list for the RPG that allows an item to be picked from an item list, used, and then deleted from the list: however, I can't seem to get this to work. Could someone please make me a project that shows how I would go about doing this? Help would be highly appreciated.

Offline

 

#2 2011-06-20 22:35:07

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Variable list assistance

Depends on what method you want to use...you could use several, but probably the easiest would be something like this:

When flag clicked:
list=(fish,cat,dog,bone,fire,gun)
forever
if key space pressed
  ask "What item would you like to use? Type the item number."
  broadcast (item (answer) of list)
  delete item (answer) of list
end

and for your sprite, you would have a broadcast script to run when it comes, such as:

When I receive (fish)
change hunger by (-5)
say "I ate the fish!  That was good!" for 4 seconds

If you have many items and don't want to use so many scripts, use a variable almost in the same way.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

Board footer