[Solved] How do I add an inventory remaining counter? [closed]


You never define item_type_qty. All you ever do with it in your class is this:

self.item_type_qty[["Pants",20],["Dress",20]]

Which has no effect, since it looks like you’re trying to get a value out using weird indexes. If you meant to assign it, do it like this:

self.item_type_qty = [["Pants",20],["Dress",20]]

However, you’ll run into another problem with this line:

for x in c.item_type_qty:

That line is run before you call inhand, meaning item_type_qty will be still undefined when that line is reached, throwing that error anyway. You kind of have a circular dependency going on, where you try to loop through item_type_qty, which is set by inhand(), but then in your loop you call inhand() with x[0] and x[1], but x is an item from item_type_qty, which is defined in inhand. Just kind of a messy situation that doesn’t make sense.

0

solved How do I add an inventory remaining counter? [closed]