first off, I'm trying to display all the stocked items in a shop with a for loop in my shop screen, since all the items have the same code... but instead of displaying four different items, it's displaying the final item four times, with some extra data in the front. here's my code:
Code: Select all
vbox:
xalign 0.5
yalign 0.5
for item in enumerate(a_Stock):
vbox:
text "[item]"
also, I'm trying to call a "buy" function I wrote in python, but my understanding of currying is sooo poor, so I'm probably doing this all wrong. it's not giving me any errors, it just doesn't seem to actually be doing anything? my code looks like this:
Code: Select all
## this is over in my init python block
def BuyItem(item, money):
for x in range(0, len(a_OwnedItems)):
if a_OwnedItems[x] == item:
a_OwnedItems[x][1] += 1
money -= item[3]
return
a_OwnedItems.append( copy.deepcopy(item[:]))
money -= item[3]
return
## shop code (I removed a lot of extra stuff to make this post cleaner, but this basic code doesn't work either)
screen Buy:
python:
buy = renpy.curry(BuyItem)
frame:
xalign 0.5
yalign 0.5
vbox:
xalign 0.5
yalign 0.5
text "[i_Money]" # displays current amount of money
text "[a_Stock[0][0]]" # displays the name of first item in stock
textbutton "Buy Item?" action buy(a_Stock[0], i_Money)
textbutton "return" action Return