Discuss Scratch

astroglider661
Scratcher
100+ posts

Adding a list to a list.

In my game my life 2, I'm trying to make a working shop.

When you click on the shelf, and click on an item in that shelf, it will add it's cost to a variable called “price” and add it's name to a list called
“What I'm buying”.

When your done shopping, you say your done. Whats inside the “what i'm buying” goes into another list called “inventory” and obviously you lose some cash.

The problem is, it doesn't add the items separately in the inventory. (it adds every item into 1 list entry).

If your confused:

Inventory: WHAT IS HAPPENING NOW Inventory: WHAT I WANT
Water 1 Water
1 Apple 2 Apple
Potato chips 3 Potato chips

The Glitched Game

Please help. Link is above.

Last edited by astroglider661 (Aug. 7, 2017 16:38:33)


my last signature was cringe
TheArcadeGuy
Scratcher
100+ posts

Adding a list to a list.

Here you go:

when I receive [transfer lists]
set [item#] to [1]
repeat (length of [What I'm buying] :: list)
add (item (item#) of [What I'm buying] :: list) to [inventory]
change [item#] by (1)
end



astroglider661
Scratcher
100+ posts

Adding a list to a list.

TheArcadeGuy wrote:

Here you go:

when I receive [transfer lists]
set [item#] to [1]
repeat (length of [What I'm buying] :: list)
add (item (item#) of [What I'm buying] :: list) to [inventory]
change [item#] by (1)
end

Thanks so much now it works!!!

my last signature was cringe

Powered by DjangoBB