From d48708579bca3b48fa4ad1911710a55348a89cb6 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:16:26 +0100 Subject: [PATCH] Fix misuse of variable - don't use a reserved name (starting with an underscore) - use a file-local mangled name (starting with two underscores - use renpy.dynamx to cleanup the variable automatically (cherry picked from commit 3e86094b0b68321703bc6de21b95bf4c450715fb) --- .../tonks/clothing_upgrades_NOT_IN_USE.txt | 24 ++-- game/scripts/interface/achievements.rpy | 18 +-- game/scripts/interface/book.rpy | 10 +- game/scripts/interface/brewing.rpy | 16 +-- game/scripts/interface/door.rpy | 14 +-- game/scripts/interface/inventory.rpy | 22 ++-- game/scripts/interface/stats.rpy | 12 +- .../minigames/cardgame/_deck_builder_.rpy | 28 ++--- game/scripts/minigames/dueling/signs.rpy | 20 +-- game/scripts/minigames/mirror/menu.rpy | 22 ++-- game/scripts/rooms/main_room/objects/desk.rpy | 36 +++--- game/scripts/shops/dress/menu.rpy | 18 +-- game/scripts/shops/item/menu.rpy | 18 +-- game/scripts/wardrobe/wardrobe.rpy | 114 +++++++++--------- 14 files changed, 186 insertions(+), 186 deletions(-) diff --git a/game/scripts/characters/tonks/clothing_upgrades_NOT_IN_USE.txt b/game/scripts/characters/tonks/clothing_upgrades_NOT_IN_USE.txt index 1416c505..98ca7d93 100644 --- a/game/scripts/characters/tonks/clothing_upgrades_NOT_IN_USE.txt +++ b/game/scripts/characters/tonks/clothing_upgrades_NOT_IN_USE.txt @@ -103,25 +103,25 @@ label upgrades_menu(xx=150, yy=90): with d3 label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "category": - $ current_category = _choice[1] + if __choice[0] == "category": + $ current_category = __choice[1] $ category_items = 0 $ menu_items = upgrades_sortfilter([], current_sorting) $ menu_items_length = len(menu_items) $ current_item = 0 - elif _choice[0] == "subcat": - if _choice[1] != current_subcategory: - $ current_subcategory = _choice[1] - elif _choice[0] == "buy": - if game.gold >= _choice[1] and ton_friendship >= _choice[3]*25: + elif __choice[0] == "subcat": + if __choice[1] != current_subcategory: + $ current_subcategory = __choice[1] + elif __choice[0] == "buy": + if game.gold >= __choice[1] and ton_friendship >= __choice[3]*25: python: renpy.play('sounds/money.ogg') - game.gold -= _choice[1] - _list = _choice[2] - _iter = _choice[3] + game.gold -= __choice[1] + _list = __choice[2] + _iter = __choice[3] item_bought = True @@ -129,7 +129,7 @@ label upgrades_menu(xx=150, yy=90): if not _list[i].unlocked: _list[i].unlock() ton_clothing_upgrades += 1 - elif ton_friendship < _choice[4]: + elif ton_friendship < __choice[4]: $ renpy.play('sounds/fail.ogg') "> Tonks doesn't like you enough." else: diff --git a/game/scripts/interface/achievements.rpy b/game/scripts/interface/achievements.rpy index b90b29c7..ae8ff167 100644 --- a/game/scripts/interface/achievements.rpy +++ b/game/scripts/interface/achievements.rpy @@ -201,12 +201,12 @@ label achievement_menu(xx=150, yy=90): label .after_init: python: - _choice = ui.interact() + renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "select": - current_item = _choice[1] - elif _choice[0] == "category": - current_category = _choice[1] + if __choice[0] == "select": + current_item = __choice[1] + elif __choice[0] == "category": + current_category = __choice[1] if current_category == "All": category_items = list(persistent.achievements.items()) else: @@ -215,11 +215,11 @@ label achievement_menu(xx=150, yy=90): menu_items_length = len(menu_items) current_page = 0 current_item = next(iter(menu_items), None) - elif _choice == "inc": + elif __choice == "inc": current_page += 1 - elif _choice == "dec": + elif __choice == "dec": current_page += -1 - elif _choice == "filter": + elif __choice == "filter": if current_filter == None: current_filter = "Locked" elif current_filter == "Locked": @@ -232,7 +232,7 @@ label achievement_menu(xx=150, yy=90): menu_items_length = len(menu_items) current_page = 0 current_item = next(iter(menu_items), None) - elif _choice == "sort": + elif __choice == "sort": if current_sorting == "A-z": current_sorting = "z-A" elif current_sorting == "z-A": diff --git a/game/scripts/interface/book.rpy b/game/scripts/interface/book.rpy index 908d4cc4..93b0a68a 100644 --- a/game/scripts/interface/book.rpy +++ b/game/scripts/interface/book.rpy @@ -79,24 +79,24 @@ label book_handle(book=None): show screen book_animator("book_page_next", 0.5) label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice == "next": + if __choice == "next": $ book.next() play sound "sounds/pageflip.ogg" show screen book_animator("book_page_next", 0.5) with d1 - elif _choice == "prev": + elif __choice == "prev": $ book.prev() play sound "sounds/pageflip.ogg" show screen book_animator("book_page_prev", 0.5) with d1 - elif _choice == "back": + elif __choice == "back": $ book.open() play sound "sounds/pageflipback.ogg" show screen book_animator("book_page_start", 0.5) with d1 - elif _choice == "Close": + elif __choice == "Close": $ book.close() play sound "sounds/bookclose.ogg" return diff --git a/game/scripts/interface/brewing.rpy b/game/scripts/interface/brewing.rpy index 645e01d2..97b94b8e 100644 --- a/game/scripts/interface/brewing.rpy +++ b/game/scripts/interface/brewing.rpy @@ -31,11 +31,11 @@ label brewing_menu(xx=150, yy=90): show screen brewing(xx, yy) label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "select": - $ current_item = _choice[1] - elif _choice == "filter": + if __choice[0] == "select": + $ current_item = __choice[1] + elif __choice == "filter": if current_filter == "Unlocked": $ current_filter = None elif current_filter == None: @@ -44,7 +44,7 @@ label brewing_menu(xx=150, yy=90): $ menu_items = brewing_sortfilter(inventory.get_instances_of_type("potion"), current_sorting, current_filter) $ menu_items_length = len(menu_items) $ current_item = next(iter(menu_items), None) - elif _choice == "sort": + elif __choice == "sort": if current_sorting == "A-z": $ current_sorting = "z-A" else: @@ -53,10 +53,10 @@ label brewing_menu(xx=150, yy=90): $ menu_items = brewing_sortfilter(inventory.get_instances_of_type("potion"), current_sorting, current_filter) $ menu_items_length = len(menu_items) #$ current_item = next(iter(menu_items), None) - elif _choice[0] == "make": - if _choice[1].has_ingredients(): + elif __choice[0] == "make": + if __choice[1].has_ingredients(): play sound "sounds/bubble.ogg" - $ _choice[1].make() + $ __choice[1].make() else: gen "It appears I'm missing some key ingredients..." ("base", xpos="far_left", ypos="head") else: diff --git a/game/scripts/interface/door.rpy b/game/scripts/interface/door.rpy index 6f06bdae..53e25f06 100644 --- a/game/scripts/interface/door.rpy +++ b/game/scripts/interface/door.rpy @@ -34,18 +34,18 @@ label summon_menu(xx=723, yy=90): show screen summon(xx, yy) - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "summon": + if __choice[0] == "summon": hide screen summon - if not _choice[2]: + if not __choice[2]: $ enable_game_menu() - $ renpy.jump_out_of_context("summon_"+_choice[1].lower()) + $ renpy.jump_out_of_context("summon_"+__choice[1].lower()) else: - if game.daytime or _choice[1] in ["Tonks", "Snape"]: - nar "[_choice[1]] is currently busy. Try again later." + if game.daytime or __choice[1] in ["Tonks", "Snape"]: + nar "[__choice[1]] is currently busy. Try again later." else: - nar "[_choice[1]] is currently asleep. Try again tomorrow." + nar "[__choice[1]] is currently asleep. Try again tomorrow." else: hide screen summon return diff --git a/game/scripts/interface/inventory.rpy b/game/scripts/interface/inventory.rpy index 6ba4a385..9974d28b 100644 --- a/game/scripts/interface/inventory.rpy +++ b/game/scripts/interface/inventory.rpy @@ -62,13 +62,13 @@ label inventory_menu(xx=150, yy=90): label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "select": - $ current_item = _choice[1] - elif _choice[0] == "category": + if __choice[0] == "select": + $ current_item = __choice[1] + elif __choice[0] == "category": python: - current_category = _choice[1] + current_category = __choice[1] category_items = inventory_dict[current_category] menu_items = inventory_sortfilter(category_items, current_sorting, current_filter) menu_items_length = len(menu_items) @@ -79,11 +79,11 @@ label inventory_menu(xx=150, yy=90): current_page = 0 current_item = next(iter(menu_items), None) - elif _choice == "inc": + elif __choice == "inc": $ current_page += 1 - elif _choice == "dec": + elif __choice == "dec": $ current_page += -1 - elif _choice == "sort": + elif __choice == "sort": python: if current_sorting == "A-z": current_sorting = "z-A" @@ -104,7 +104,7 @@ label inventory_menu(xx=150, yy=90): if not current_item or not menu_items_length: current_item = next(iter(menu_items), None) - elif _choice == "filter": + elif __choice == "filter": python: if current_filter == None: current_filter = "Owned" @@ -121,11 +121,11 @@ label inventory_menu(xx=150, yy=90): if not current_item or not menu_items_length: current_item = next(iter(menu_items), None) - elif _choice == "use": + elif __choice == "use": python: enable_game_menu() current_item.use() - elif _choice == "give": + elif __choice == "give": if current_item.type == "gift": if get_character_gifted(states.active_girl): diff --git a/game/scripts/interface/stats.rpy b/game/scripts/interface/stats.rpy index 06987cab..e1deb41f 100644 --- a/game/scripts/interface/stats.rpy +++ b/game/scripts/interface/stats.rpy @@ -111,18 +111,18 @@ label stats_menu(xx=150, yy=90): show screen stats(xx, yy) label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "category": - $ current_category = _choice[1] + if __choice[0] == "category": + $ current_category = __choice[1] $ category_items = stats_dict[current_category] $ menu_items = stats_sortfilter(category_items, current_sorting) $ menu_items_length = len(menu_items) $ current_item = stats_dict[current_category] #$ current_subcategory = "overview" - elif _choice[0] == "subcat": - if _choice[1] != current_subcategory: - $ current_subcategory = _choice[1] + elif __choice[0] == "subcat": + if __choice[1] != current_subcategory: + $ current_subcategory = __choice[1] else: hide screen stats return diff --git a/game/scripts/minigames/cardgame/_deck_builder_.rpy b/game/scripts/minigames/cardgame/_deck_builder_.rpy index 79a8101a..35775f0e 100644 --- a/game/scripts/minigames/cardgame/_deck_builder_.rpy +++ b/game/scripts/minigames/cardgame/_deck_builder_.rpy @@ -5,34 +5,34 @@ label deck_builder: label deck_builder_jump: show screen deck_builder_screen $ renpy.block_rollback() - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice in unlocked_cards: - $ selectcard = unlocked_cards.index(_choice) + if __choice in unlocked_cards: + $ selectcard = unlocked_cards.index(__choice) jump deck_builder_jump - elif _choice == "gallery": + elif __choice == "gallery": hide screen deck_builder_screen show screen deck_builder_gallery - elif _choice == "back": + elif __choice == "back": hide screen deck_builder_gallery show screen deck_builder_screen - elif _choice == "Close": + elif __choice == "Close": $ selectcard = -1 hide screen deck_builder_screen jump main_room_menu - elif _choice == "guide": + elif __choice == "guide": $ selectcard = -1 hide screen deck_builder_screen jump deck_builder_guide - elif _choice == "inc": + elif __choice == "inc": $ currentpage += 1 $ selectcard = -1 jump deck_builder_jump - elif _choice == "dec": + elif __choice == "dec": $ currentpage -= 1 $ selectcard = -1 jump deck_builder_jump - elif _choice == "unselect": + elif __choice == "unselect": $ selectcard = -1 jump deck_builder_jump else: @@ -40,8 +40,8 @@ label deck_builder: python: if unlocked_cards[selectcard].copies > -1: unlocked_cards[selectcard].copies -= 1 - add_card_to_deck(playerdeck[int(_choice)].title) - playerdeck[int(_choice)] = unlocked_cards[selectcard] + add_card_to_deck(playerdeck[int(__choice)].title) + playerdeck[int(__choice)] = unlocked_cards[selectcard] selectcard = -1 pass jump deck_builder_jump @@ -256,9 +256,9 @@ label deck_builder_guide: gen "(*Shudders*)" ("base", xpos="far_left", ypos="head") gen "(Well... might as well...)" ("base", xpos="far_left", ypos="head") - #$ _choice = ui.interact() + #$ renpy.dynamic(__choice = ui.interact()) - #if _choice == "back": + #if __choice == "back": call music_block hide screen deck_builder_tutorial diff --git a/game/scripts/minigames/dueling/signs.rpy b/game/scripts/minigames/dueling/signs.rpy index cc174993..f26f0166 100644 --- a/game/scripts/minigames/dueling/signs.rpy +++ b/game/scripts/minigames/dueling/signs.rpy @@ -85,12 +85,12 @@ # $ test_sign.interactive = True -# $ _choice = ui.interact() +# $ renpy.dynamic(__choice = ui.interact()) -# if _choice[0] == "result": +# if __choice[0] == "result": # $ test_sign.interactive = False # pause 3.0 -# if _choice[1] >= 50.0: +# if __choice[1] >= 50.0: # "Magician" "Congratulations, you have passed the test with the score of [_sign_max]%%, I am proud of you!" # menu: # "Magician" "Would you like to keep playing?" @@ -116,21 +116,21 @@ # show screen draw_magic -# $ _choice = ui.interact() +# $ renpy.dynamic(__choice = ui.interact()) -# if _choice[0] == "result": +# if __choice[0] == "result": # $ test_sign.interactive = False # pause 3.0 -# if _choice[1] == 0.0: +# if __choice[1] == 0.0: # "Magician" "You suck." -# elif 25.0 > _choice[1] > 0.0: +# elif 25.0 > __choice[1] > 0.0: # "Magician" "You still suck." -# elif 50.0 > _choice[1] > 25.0: +# elif 50.0 > __choice[1] > 25.0: # "Magician" "You're average." -# elif 75.0 > _choice[1] > 50.0: +# elif 75.0 > __choice[1] > 50.0: # "Magician" "You're above average." -# elif 100.0 > _choice[1] > 75.0: +# elif 100.0 > __choice[1] > 75.0: # "Magician" "You're good." # else: # "Magician" "Holy shit! CRITICAL HIT!" diff --git a/game/scripts/minigames/mirror/menu.rpy b/game/scripts/minigames/mirror/menu.rpy index c4f01ca5..35fcf619 100644 --- a/game/scripts/minigames/mirror/menu.rpy +++ b/game/scripts/minigames/mirror/menu.rpy @@ -35,23 +35,23 @@ label mirror_menu(xx=150, yy=90): show screen mirror(xx, yy) label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "select": - $ current_item = _choice[1] + if __choice[0] == "select": + $ current_item = __choice[1] $ current_item.seen = True - elif _choice[0] == "category": - $ current_category = _choice[1] + elif __choice[0] == "category": + $ current_category = __choice[1] $ menu_items = mirror_sortfilter(mirror.get_instances_of_tag(current_category), current_sorting, current_filter) $ menu_items_length = len(menu_items) $ current_page = 0 $ current_item = next(iter(menu_items), None) - elif _choice == "inc": + elif __choice == "inc": $ current_page += 1 - elif _choice == "dec": + elif __choice == "dec": $ current_page += -1 - elif _choice == "filter": + elif __choice == "filter": if current_filter == "Unlocked": $ current_filter = None elif current_filter == None: @@ -61,7 +61,7 @@ label mirror_menu(xx=150, yy=90): $ menu_items_length = len(menu_items) $ current_page = 0 $ current_item = next(iter(menu_items), None) - elif _choice == "sort": + elif __choice == "sort": if current_sorting == "A-z": $ current_sorting = "z-A" else: @@ -71,8 +71,8 @@ label mirror_menu(xx=150, yy=90): $ menu_items_length = len(menu_items) $ current_page = 0 $ current_item = next(iter(menu_items), None) - elif _choice[0] == "play": - $ _choice[1].play() + elif __choice[0] == "play": + $ __choice[1].play() $ renpy.jump_out_of_context("mirror") else: $ enable_game_menu() diff --git a/game/scripts/rooms/main_room/objects/desk.rpy b/game/scripts/rooms/main_room/objects/desk.rpy index e310e56c..8f3fdca4 100644 --- a/game/scripts/rooms/main_room/objects/desk.rpy +++ b/game/scripts/rooms/main_room/objects/desk.rpy @@ -47,21 +47,21 @@ label desk: show screen desk_menu with d1 - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) hide screen desk_menu #Do NOT add a transition here! #Hermione - if _choice == "hermione" and states.her.busy: + if __choice == "hermione" and states.her.busy: if game.daytime: nar "Hermione is taking classes." jump main_room_menu else: nar "Hermione is already asleep." jump main_room_menu - elif _choice == "hermione" and not states.her.busy: + elif __choice == "hermione" and not states.her.busy: if states.her.map_location == "forest": nar "Hermione is currently at the Forbidden Forest.\n>Would you like to go there?" menu: @@ -73,78 +73,78 @@ label desk: jump summon_hermione #Luna - elif states.lun.unlocked and _choice == "luna" and states.lun.busy: + elif states.lun.unlocked and __choice == "luna" and states.lun.busy: if game.daytime: nar "Luna is taking classes." jump main_room_menu else: nar "Luna is already asleep." jump main_room_menu - elif states.lun.unlocked and _choice == "luna" and not states.lun.busy: + elif states.lun.unlocked and __choice == "luna" and not states.lun.busy: jump summon_luna #Astoria - elif states.ast.busy and _choice == "astoria": + elif states.ast.busy and __choice == "astoria": if game.daytime: nar "Astoria is taking classes." jump main_room_menu else: nar "Astoria is already asleep." jump main_room_menu - elif not states.ast.busy and _choice == "astoria": #Summoning after intro events done. + elif not states.ast.busy and __choice == "astoria": #Summoning after intro events done. jump summon_astoria #Susan - elif _choice == "susan" and states.sus.busy: + elif __choice == "susan" and states.sus.busy: if game.daytime: nar "Susan is taking classes." jump main_room_menu else: nar "Susan is already asleep." jump main_room_menu - elif _choice == "susan" and not states.sus.busy: + elif __choice == "susan" and not states.sus.busy: jump summon_susan #Cho - elif _choice == "cho" and states.cho.busy: + elif __choice == "cho" and states.cho.busy: if game.daytime: nar "Cho is taking classes." jump main_room_menu else: nar "Cho is already asleep." jump main_room_menu - elif _choice == "cho" and not states.cho.busy: + elif __choice == "cho" and not states.cho.busy: jump summon_cho #Snape - elif _choice == "snape" and states.sna.busy: + elif __choice == "snape" and states.sna.busy: nar "Professor Snape is unavailable." if game.daytime: jump main_room_menu else: jump main_room_menu - elif _choice == "snape" and not states.sna.busy: + elif __choice == "snape" and not states.sna.busy: jump summon_snape #Tonks - elif _choice == "tonks" and states.ton.busy: + elif __choice == "tonks" and states.ton.busy: nar "Tonks is unavailable." if game.daytime: jump main_room_menu else: jump main_room_menu - elif _choice == "tonks" and not states.ton.busy: + elif __choice == "tonks" and not states.ton.busy: jump summon_tonks #Close - elif _choice == "Close": + elif __choice == "Close": jump main_room_menu - elif _choice in {"snape_office", "seventh_floor", "map_lake", "map_forest", "map_attic", "clothing_store", "item_store", "ravenclaw_dormitories", "gryffindor_dormitories"}: + elif __choice in {"snape_office", "seventh_floor", "map_lake", "map_forest", "map_attic", "clothing_store", "item_store", "ravenclaw_dormitories", "gryffindor_dormitories"}: call gen_chibi("stand", "desk", "base") with d3 call gen_walk(action="leave", speed=1.5) - $ renpy.jump(_choice) + $ renpy.jump(__choice) screen desk_menu(): tag desk_interface diff --git a/game/scripts/shops/dress/menu.rpy b/game/scripts/shops/dress/menu.rpy index 1eed28df..4fad841d 100644 --- a/game/scripts/shops/dress/menu.rpy +++ b/game/scripts/shops/dress/menu.rpy @@ -33,24 +33,24 @@ label shop_dress_menu: label .after_init: - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "category": - $ current_category = _choice[1] + if __choice[0] == "category": + $ current_category = __choice[1] $ menu_items = shop_dress_sortfilter((x for x in category_items.get(current_category, []) if (x.unlocked == False and x.price > 0 and x not in store_cart)), current_sorting) $ current_item = next(iter(menu_items), None) - elif _choice[0] == "buy": + elif __choice[0] == "buy": show screen blktone with d3 - if game.gold < _choice[1].price: + if game.gold < __choice[1].price: gen "(I don't have enough gold.)" ("base", xpos="far_left", ypos="head") else: if len(store_cart) < 5: - $ renpy.call("purchase_outfit", _choice[1]) + $ renpy.call("purchase_outfit", __choice[1]) play sound "sounds/money.ogg" - $ game.gold -= _choice[1].price - $ store_cart.add(_choice[1]) + $ game.gold -= __choice[1].price + $ store_cart.add(__choice[1]) $ menu_items = shop_dress_sortfilter((x for x in category_items.get(current_category, []) if (x.unlocked == False and x.price > 0 and x not in store_cart)), current_sorting) $ current_item = next(iter(menu_items), None) @@ -63,7 +63,7 @@ label shop_dress_menu: hide screen blktone with d3 - elif _choice == "sort": + elif __choice == "sort": if current_sorting == "Price (Asc)": $ current_sorting = "Price (Desc)" elif current_sorting == "Price (Desc)": diff --git a/game/scripts/shops/item/menu.rpy b/game/scripts/shops/item/menu.rpy index 62f3ddf5..6e20ad0a 100644 --- a/game/scripts/shops/item/menu.rpy +++ b/game/scripts/shops/item/menu.rpy @@ -43,12 +43,12 @@ label shop_item_menu(xx=150, yy=90): show screen shop_item(xx, yy) label .after_init: - $ _choice = ui.interact() + $ renpy.dynamix(__choice = ui.interact()) - if _choice[0] == "select": - $ current_item = _choice[1] - elif _choice[0] == "category": - $ current_category = _choice[1] + if __choice[0] == "select": + $ current_item = __choice[1] + elif __choice[0] == "category": + $ current_category = __choice[1] if current_category in {"Gifts", "Ingredients"}: $ category_items = [x for x in inventory_dict[current_category] if bool(x.price > 0 and x.unlocked)] elif current_category in {"Books", "Scrolls", "Decorations", "Quest Items"}: @@ -58,18 +58,18 @@ label shop_item_menu(xx=150, yy=90): $ current_page = 0 $ current_item = next(iter(menu_items), None) pass - elif _choice == "inc": + elif __choice == "inc": $ current_page += 1 - elif _choice == "dec": + elif __choice == "dec": $ current_page += -1 - elif _choice == "sort": + elif __choice == "sort": if current_sorting == "Price (Asc)": $ current_sorting = "Price (Desc)" elif current_sorting == "Price (Desc)": $ current_sorting = "Price (Asc)" $ menu_items = shop_item_sortfilter(category_items, current_sorting) - elif _choice == "buy": + elif __choice == "buy": $ renpy.call("purchase_item", current_item) if current_category in {"Gifts", "Ingredients"}: diff --git a/game/scripts/wardrobe/wardrobe.rpy b/game/scripts/wardrobe/wardrobe.rpy index 728044dc..b553e79d 100644 --- a/game/scripts/wardrobe/wardrobe.rpy +++ b/game/scripts/wardrobe/wardrobe.rpy @@ -271,12 +271,12 @@ label wardrobe_menu(): # while mixing python and renpy scope # https://github.com/renpy/renpy/issues/959 - $ _choice = ui.interact() + $ renpy.dynamic(__choice = ui.interact()) - if _choice[0] == "category": - if not current_category == _choice[1]: - if wardrobe_check_category(_choice[1]): - $ current_category = _choice[1] + if __choice[0] == "category": + if not current_category == __choice[1]: + if wardrobe_check_category(__choice[1]): + $ current_category = __choice[1] $ category_items = set_wardrobe_categories(current_category) $ current_subcategory = list(category_items.keys())[0] if category_items else "" @@ -292,13 +292,13 @@ label wardrobe_menu(): elif current_category == "piercings & tattoos": $ char_active.strip("top", "bottom", "robe", "accessory", "bra", "panties", "stockings", "gloves") else: - $ wardrobe_react("category_fail", _choice[1]) + $ wardrobe_react("category_fail", __choice[1]) $ rebuild_wardrobe_icons(category_items, current_subcategory) - elif _choice[0] == "subcategory": - if not current_subcategory == _choice[1]: - $ current_subcategory = _choice[1] + elif __choice[0] == "subcategory": + if not current_subcategory == __choice[1]: + $ current_subcategory = __choice[1] if current_category == "outfits": $ char_active.clear_outfit_button_cache() @@ -307,19 +307,19 @@ label wardrobe_menu(): $ rebuild_wardrobe_icons(category_items, current_subcategory) - elif _choice[0] == "equip": + elif __choice[0] == "equip": ### CLOTHING ### - if isinstance(_choice[1], DollCloth): - if _choice[1].type == "hair" and char_active.is_equipped_item(_choice[1]): + if isinstance(__choice[1], DollCloth): + if __choice[1].type == "hair" and char_active.is_equipped_item(__choice[1]): play sound "sounds/fail.ogg" $ renpy.notify("Hair cannot be removed.") else: - if char_active.is_equipped_item(_choice[1]): + if char_active.is_equipped_item(__choice[1]): # UNEQUIP - if wardrobe_check_unequip(_choice[1]): - $ wardrobe_react("unequip", _choice[1]) - $ char_active.unequip(_choice[1]) + if wardrobe_check_unequip(__choice[1]): + $ wardrobe_react("unequip", __choice[1]) + $ char_active.unequip(__choice[1]) if current_item: $ current_item.clear_button_cache() @@ -327,61 +327,61 @@ label wardrobe_menu(): $ current_item = None else: - $ wardrobe_react("unequip_fail", _choice[1]) + $ wardrobe_react("unequip_fail", __choice[1]) else: # EQUIP - if wardrobe_check_equip(_choice[1]): - $ wardrobe_react("equip", _choice[1]) + if wardrobe_check_equip(__choice[1]): + $ wardrobe_react("equip", __choice[1]) # Blacklist handling - if not wardrobe_check_blacklist(_choice[1]): - $ wardrobe_react("blacklist", _choice[1]) + if not wardrobe_check_blacklist(__choice[1]): + $ wardrobe_react("blacklist", __choice[1]) - $ _choice[1].mark_as_seen() - $ char_active.equip(_choice[1]) + $ __choice[1].mark_as_seen() + $ char_active.equip(__choice[1]) if current_item: $ current_item.clear_button_cache() $ current_item.build_button() - $ current_item = _choice[1] + $ current_item = __choice[1] $ current_item.clear_button_cache() $ current_item.build_button() - if wardrobe_fallback_required(_choice[1]): + if wardrobe_fallback_required(__choice[1]): # Has to be called regardless of player preference. - $ renpy.call(get_character_response(states.active_girl, "fallback"), _choice[1]) + $ renpy.call(get_character_response(states.active_girl, "fallback"), __choice[1]) else: - $ wardrobe_react("equip_fail", _choice[1]) + $ wardrobe_react("equip_fail", __choice[1]) ### OUTFIT ### - elif isinstance(_choice[1], DollOutfit): + elif isinstance(__choice[1], DollOutfit): $ _outfit = char_active.create_outfit(temp=True) - if _outfit == _choice[1]: + if _outfit == __choice[1]: $ renpy.notify("Load failed: Outfit already equipped.") else: - if wardrobe_check_equip_outfit(_choice[1]): + if wardrobe_check_equip_outfit(__choice[1]): if not _outfit.exists(): $ _confirmed = wardrobe_suppress_warnings or renpy.call_screen("confirm", "Discard unsaved changes and load this outfit?") if _confirmed: - $ wardrobe_react("equip_outfit", _choice[1]) - $ char_active.equip(_choice[1]) - $ current_item = _choice[1] + $ wardrobe_react("equip_outfit", __choice[1]) + $ char_active.equip(__choice[1]) + $ current_item = __choice[1] else: $ renpy.notify("Load failed: Cancelled by user.") else: - $ wardrobe_react("equip_outfit", _choice[1]) - $ char_active.equip(_choice[1]) - $ current_item = _choice[1] + $ wardrobe_react("equip_outfit", __choice[1]) + $ char_active.equip(__choice[1]) + $ current_item = __choice[1] else: - $ wardrobe_react("equip_outfit_fail", _choice[1]) + $ wardrobe_react("equip_outfit_fail", __choice[1]) - elif _choice[0] == "setcolor": + elif __choice[0] == "setcolor": python: - current_item.set_color(_choice[1]) + current_item.set_color(__choice[1]) current_item.clear_button_cache() current_item.build_button() @@ -400,21 +400,21 @@ label wardrobe_menu(): if rebuild: outfit.is_stale() - elif _choice[0] == "touch": - if wardrobe_check_touch(_choice[1]): - $ wardrobe_react("touch", _choice[1]) + elif __choice[0] == "touch": + if wardrobe_check_touch(__choice[1]): + $ wardrobe_react("touch", __choice[1]) else: - $ wardrobe_react("touch_fail", _choice[1]) + $ wardrobe_react("touch_fail", __choice[1]) - elif _choice[0] == "addoutfit": + elif __choice[0] == "addoutfit": python: _outfit = char_active.create_outfit(temp=True) if _outfit.exists(): renpy.notify("Save failed: Outfit already exists.") else: - if _choice[1]: - _index = char_active.outfits.index(_choice[1]) + if __choice[1]: + _index = char_active.outfits.index(__choice[1]) _confirmed = wardrobe_suppress_warnings or renpy.call_screen("confirm", "Overwrite this outfit?") if _confirmed: @@ -440,32 +440,32 @@ label wardrobe_menu(): category_items = set_wardrobe_categories(current_category) - elif _choice[0] == "deloutfit": + elif __choice[0] == "deloutfit": python: _confirmed = wardrobe_suppress_warnings or renpy.call_screen("confirm", "Delete this outfit?") if _confirmed: - _choice[1].delete() + __choice[1].delete() category_items = set_wardrobe_categories(current_category) renpy.notify("Outfit Deleted.") - elif _choice[0] == "export": + elif __choice[0] == "export": python: filename = renpy.input("Save as:", datetime.datetime.now().strftime("%d %b %Y-%H%M%S")) if not filename.endswith(".png"): filename += ".png" - _choice[1].export_data(filename) + __choice[1].export_data(filename) achievements.unlock("export") - elif _choice[0] == "import": - $ _outfit = char_active.import_outfit(_choice[1]) + elif __choice[0] == "import": + $ _outfit = char_active.import_outfit(__choice[1]) - elif _choice[0] == "schedule": - $ renpy.call_screen("wardrobe_schedule_menuitem", _choice[1]) + elif __choice[0] == "schedule": + $ renpy.call_screen("wardrobe_schedule_menuitem", __choice[1]) - elif _choice == "music": + elif __choice == "music": python: if wardrobe_music: wardrobe_music = False @@ -474,7 +474,7 @@ label wardrobe_menu(): wardrobe_music = True renpy.music.play("music/Spring_In_My_Step.ogg", fadein=1) - elif _choice == "randomise": + elif __choice == "randomise": python: _confirmed = False @@ -554,7 +554,7 @@ label wardrobe_menu(): current_item.clear_button_cache() current_item.build_button(current_subcategory) - else: #_choice == "Close": + else: #__choice == "Close": python: _confirmed = False