Use hide instead of single-use function
This commit is contained in:
parent
b2196d3ca5
commit
ebcfa4b78d
@ -58,39 +58,6 @@ init python:
|
|||||||
|
|
||||||
renpy.restart_interaction()
|
renpy.restart_interaction()
|
||||||
|
|
||||||
def __init_scope():
|
|
||||||
if inventory_mode == 0:
|
|
||||||
inventory_dict = {
|
|
||||||
"Gifts": inventory.get_instances_of_type("gift"),
|
|
||||||
"Books": inventory.get_instances_of_type("book"),
|
|
||||||
"Scrolls": inventory.get_instances_of_type("scroll"),
|
|
||||||
"Ingredients": inventory.get_instances_of_type("ingredient"),
|
|
||||||
"Potions": inventory.get_instances_of_type("potion"),
|
|
||||||
"Decorations": inventory.get_instances_of_type("decoration"),
|
|
||||||
"Quest Items": inventory.get_instances_of_type("quest"),
|
|
||||||
}
|
|
||||||
elif inventory_mode == 1:
|
|
||||||
inventory_dict = {
|
|
||||||
"Gifts": inventory.get_instances_of_type("gift"),
|
|
||||||
"Potions": inventory.get_instances_of_type("potion"),
|
|
||||||
"Quest Items": inventory.get_instances_of_type("quest"),
|
|
||||||
}
|
|
||||||
|
|
||||||
renpy.dynamic(
|
|
||||||
inventory_dict=inventory_dict,
|
|
||||||
current_page=0,
|
|
||||||
current_category="Gifts",
|
|
||||||
current_filter="Owned",
|
|
||||||
current_sorting="Available",
|
|
||||||
)
|
|
||||||
|
|
||||||
menu_items = inventory_sortfilter(inventory_dict[current_category], current_sorting, current_filter)
|
|
||||||
renpy.dynamic(
|
|
||||||
menu_items=menu_items,
|
|
||||||
menu_items_length=len(menu_items),
|
|
||||||
current_item=next(iter(menu_items), None),
|
|
||||||
)
|
|
||||||
|
|
||||||
define items_shown = 36
|
define items_shown = 36
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
@ -203,7 +170,39 @@ label .give_item(item):
|
|||||||
label inventory_menu(xx=150, yy=90, inventory_mode=0): # 0 - Inventory, 1 - gifts
|
label inventory_menu(xx=150, yy=90, inventory_mode=0): # 0 - Inventory, 1 - gifts
|
||||||
# Inventory dictionary
|
# Inventory dictionary
|
||||||
|
|
||||||
$ __init_scope()
|
python hide:
|
||||||
|
# hide so that they are not set before being declared dynamic
|
||||||
|
if inventory_mode == 0:
|
||||||
|
inventory_dict = {
|
||||||
|
"Gifts": inventory.get_instances_of_type("gift"),
|
||||||
|
"Books": inventory.get_instances_of_type("book"),
|
||||||
|
"Scrolls": inventory.get_instances_of_type("scroll"),
|
||||||
|
"Ingredients": inventory.get_instances_of_type("ingredient"),
|
||||||
|
"Potions": inventory.get_instances_of_type("potion"),
|
||||||
|
"Decorations": inventory.get_instances_of_type("decoration"),
|
||||||
|
"Quest Items": inventory.get_instances_of_type("quest"),
|
||||||
|
}
|
||||||
|
elif inventory_mode == 1:
|
||||||
|
inventory_dict = {
|
||||||
|
"Gifts": inventory.get_instances_of_type("gift"),
|
||||||
|
"Potions": inventory.get_instances_of_type("potion"),
|
||||||
|
"Quest Items": inventory.get_instances_of_type("quest"),
|
||||||
|
}
|
||||||
|
|
||||||
|
renpy.dynamic(
|
||||||
|
inventory_dict=inventory_dict,
|
||||||
|
current_page=0,
|
||||||
|
current_category="Gifts",
|
||||||
|
current_filter="Owned",
|
||||||
|
current_sorting="Available",
|
||||||
|
)
|
||||||
|
|
||||||
|
menu_items = inventory_sortfilter(inventory_dict[current_category], current_sorting, current_filter)
|
||||||
|
renpy.dynamic(
|
||||||
|
menu_items=menu_items,
|
||||||
|
menu_items_length=len(menu_items),
|
||||||
|
current_item=next(iter(menu_items), None),
|
||||||
|
)
|
||||||
|
|
||||||
call screen inventory(xx, yy)
|
call screen inventory(xx, yy)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user