Just reverse the range

This commit is contained in:
Nick Perez
2023-03-13 07:00:51 -04:00
parent b4b24f1389
commit 0dce4c700f

View File

@@ -1504,9 +1504,9 @@ class KoboldStoryRegister(object):
else: else:
self.actions[i]["Probabilities"][token_num][token_option]["Used"] = False self.actions[i]["Probabilities"][token_num][token_option]["Used"] = False
if "Options" in self.actions[i]: if "Options" in self.actions[i]:
for option in self.actions[i]["Options"][:]: for j in reversed(range(len(self.actions[i]["Options"]))):
if option["text"] == text: if self.actions[i]["Options"][j]["text"] == text:
self.actions[i]["Options"].remove(option) del self.actions[i]["Options"][j]
if old_text != "": if old_text != "":
self.actions[i]["Options"].append({"text": old_text, "Pinned": False, "Previous Selection": False, "Edited": True}) self.actions[i]["Options"].append({"text": old_text, "Pinned": False, "Previous Selection": False, "Edited": True})
else: else: