I have an array with items and function to lose it.
Code: Select all
$ items = [("coin", "Lucky coin")];
python:
def lose(search_item):
global items
for item in items:
if (item[0] == search_item):
items.remove(item)
return True
return False
But. When I try to use this function as an imagebutton action, strange things happen. I've googled and tried many variants (see comments before action string), and there were different errors. Function doesn't work or coin is losed but after that gameplay jumps somethere I can't control etc.
Code: Select all
screen inventory:
zorder 111
default tt = Tooltip(" ")
frame:
xalign 1.0
background Solid("#0000")
xmaximum 130
ymaximum 450
xfill True
vbox:
imagebutton auto "inventory/bag_%s.png" action SetVariable("invent", not invent)
if invent:
text tt.value
hbox:
viewport id "box":
yinitial 9999
xmaximum 0.9
mousewheel True
draggable True
vbox:
for i in range(0, len(items)):
imagebutton:
idle Image(GetFN(i))
hover Image(GetFN(i))
hovered tt.Action(GetHint(i))
# tried Lose
# Lose = renpy.curry(lose)
# tried renpy.restart_interaction()
action lose(items[i][0])