Code: Select all
init python:
def item_purchase(item_id):
global money
if shop_items[item_id][5]:
shop_items[item_id][6] += 1
else:
shop_items[item_id][5] = True
shop_items[item_id][6] = 1
money -= shop_items[item_id][1]
Code: Select all
button:
$ item_name = shop_items[shop_items_to_display[i]][0]
$ item_desc = shop_items[shop_items_to_display[i]][3]
if shop_items[shop_items_to_display[i]][4] == 2:
text "{color=#999}[item_name]\n{size=16}[item_desc]{/size}{/color}"
text "{color=#999}Sold Out{/color}" xalign 1.0
else:
text "[item_name]\n{size=16}[item_desc]{/size}"
text "$" + str(shop_items[shop_items_to_display[i]][1]) xalign 1.0
action [ If (money >= shop_items[shop_items_to_display[i]][1] and shop_items[shop_items_to_display[i]][4] == 1,
[ Function(item_purchase(0)) ],
If(shop_items[shop_items_to_display[i]][4] == 1, Notify("Not enough money."))) ]
xpos 0
ypos (0 + 55 * i)