Why is this code working exactly as expected for the race selection, but not working for the guild section? No matter what I type for the guild, it just starts the loop over again. As far as I can see, they are the same. I copied/pasted. I know that's usually a code smell, but I've heard that writing a function for everything can hit performance due to all the jumping around to different blocks of code, so I'm trying to only write a function when I know I'm going to be re-using the code throughout the game. This is just for the intro, so I feel like that's probably fine.
#Get race from user:
while True:
Log("Choose a race. Your choices are Human, Elf, Golem, Fae, Seraph, or Demon. Type the race as it appears and you will be given more information and a chance to confirm your choice or cancel.")
race = input()
if race == "Human":
util.DisplayTxt("Txt\Intro\Races\Human_Info.txt")
Log("Do you want to choose Human? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif race == "Elf":
util.DisplayTxt("Txt\Intro\Races\Elf_Info.txt")
Log("Do you want to choose Elf? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif race == "Golem":
util.DisplayTxt("Txt\Intro\Races\Golem_Info.txt")
Log("Do you want to choose Golem? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif race == "Fae":
util.DisplayTxt("Txt\Intro\Races\Fae_Info.txt")
Log("Do you want to choose Fae? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif race == "Seraph":
util.DisplayTxt("Txt\Intro\Races\Seraph_Info.txt")
Log("Do you want to choose Seraph? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif race == "Demon":
util.DisplayTxt("Txt\Intro\Races\Demon_Info.txt")
Log("Do you want to choose Demon? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
else:
Log("That is not one of the choices given.")
#Get guild from user:
while True:
Log("Choose a guild. Your choices are Paladin, Hunter, Renegade, Swashbuckler, or Arcanist. Type the guild as it appears for more information and a chance to confirm or cancel.")
guild == input()
if guild == "Paladin":
util.DisplayTxt("Txt\Intro\Guilds\Paladin_Info.txt")
Log("Do you want to choose Paladin? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif guild == "Hunter":
util.DisplayTxt("Txt\Intro\Guilds\Hunter_Info.txt")
Log("Do you want to choose Hunter? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif guild == "Renegade":
util.DisplayTxt("Txt\Intro\Guilds\Renegade_Info.txt")
Log("Do you want to choose Renegade? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif guild == "Swashbuckler":
util.DisplayTxt("Txt\Intro\Guilds\Swashbuckler_Info.txt")
Log("Do you want to choose Swashbuckler? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
elif guild == "Arcanist":
util.DisplayTxt("Txt\Intro\Guilds\Arcanist_Info.txt")
Log("Do you want to choose Arcanist? Type Yes or No.")
response = input()
if response == "Yes":
break
elif response == "No":
continue
else:
Log("That is not a valid response. Please type Yes or No. Make sure you capitalize the first letter.")
Aucun commentaire:
Enregistrer un commentaire