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

#1 2008-10-16 15:13:18

67589jun
Scratcher
Registered: 2007-07-13
Posts: 1000+

Inventory (with lists)

i was trying to make an inventory with lists recently like this. you pick up an ammo box it needs to try to find if anything in the list is
named Ammo Box and and add 100 rounds for a certain kind of bullet like..a 50.caliber
round BUT it needs to read it when i press a key like 9 or m. please help!


http://i.imgur.com/I1DuR.png

Offline

 

#2 2008-10-16 15:55:35

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Inventory (with lists)

I don't think you need a value in your list called ammo box.

Just have a list called ammo and each value is the number of bullets you have for  a particular weapon.

Lets say that you want to only use a weapon if you have ammo for that weapon. Lets also say that this weapon is waepon number 9 and the ammount of ammo available is in spot 9 in the ammo list.

if (value 9 in "ammo" >0)
//switch to weapon 9


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

Board footer