fix interactive selection

This commit is contained in:
Mylloon 2023-04-01 16:26:55 +02:00
parent 342b07e6ea
commit efc3a07ee2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

14
main.py
View file

@ -23,7 +23,6 @@ if __name__ == "__main__":
# Interactive selection # Interactive selection
if (c_id == []): if (c_id == []):
# Cheat list # Cheat list
print("Enter 0 to exit.")
print("You can run multiples cheat at once, separate your choices with a space.") print("You can run multiples cheat at once, separate your choices with a space.")
print("Available cheats:") print("Available cheats:")
for idx, cheat in enumerate(c.cheats_list): for idx, cheat in enumerate(c.cheats_list):
@ -33,17 +32,14 @@ if __name__ == "__main__":
try: try:
response = [int(i) for i in input("Enter ID: ").split(" ")] response = [int(i) for i in input("Enter ID: ").split(" ")]
for i in response: for i in response:
match i: if (i > len(c.cheats_list) or i <= 0):
case 0: raise IndexError
exit(0) c_id.append(i - 1)
case j if j > len(c.cheats_list):
raise IndexError
case _:
c_id.append(i - 1)
except KeyboardInterrupt: except KeyboardInterrupt:
print("??\nBye.") print("Bye")
exit(1) exit(1)
except: except:
c_id = []
print("Invalid ID.") print("Invalid ID.")
# Instanciate and run threads # Instanciate and run threads