From ddddd3900f8c8e9acc74b0b214c40b50ab284bcd Mon Sep 17 00:00:00 2001 From: ferousFolly Date: Sat, 7 Oct 2023 23:32:39 +1100 Subject: [PATCH] fixed issue with single char multi slot mods --- reslotterGUI.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/reslotterGUI.py b/reslotterGUI.py index 2cff5d5..be8bc03 100644 --- a/reslotterGUI.py +++ b/reslotterGUI.py @@ -88,13 +88,13 @@ def SetsearchDir(firstLoad=True): searchDir = filedialog.askdirectory(title = "Select your mod's main folder") if (searchDir == ""): if (firstLoad): - root.destroy() - sys.exit("User exited") + root.destroy() + sys.exit("User exited") elif (IsValidSearch(searchDir) == False): messagebox.showerror(root.title(),"Please select the root of your mod's folder! This folder should contain a fighter folder within it!") if (firstLoad): - root.destroy() - sys.exit("Not a fighter folder") + root.destroy() + sys.exit("Not a fighter folder") return searchDir #make sure that it is a validated search folder, otherwise quit @@ -135,7 +135,7 @@ def InitSearch(firstLoad=True): searchDir = SetsearchDir(firstLoad) if (searchDir == "" and not firstLoad): - return False + return False root.searchDir = searchDir #Write new location to config file @@ -512,10 +512,15 @@ def GetAssumedShareSlot(source,fighter): return 0 def GetLastTarget(currentSlot): - if currentSlot in config["DEFAULT"]: - targetSlotStr = config["DEFAULT"][currentSlot] - return int(config["DEFAULT"][currentSlot].replace("+","").replace("c",""))+1 - return 0 + if currentSlot in config["DEFAULT"]: + targetSlotStr = config["DEFAULT"][currentSlot] + try: + targetSlotInt = int(targetSlotStr.replace("+", "").replace("c", "")) + except ValueError: + # handle the case where targetSlotStr is not a valid integer + targetSlotInt = 0 + return targetSlotInt + 1 + return 0 def RefreshSlotWindow(): for widget in root.frameCombos.winfo_children():