Open rabdill opened 9 years ago
The solution is to replace the "get_text" function used here with a new "get_int" function that asks for a new entry when it doesn't get a number. Can be used, here AND in selecting the item you want to buy in the store.
If setting the qty as an integer fails, it just turns it into a zero: ''' if command < len(current['items']): choice = get_text("How many? (You have {0} coins, or enough for as many as {1}) > ".format(player['inventory']['coins'], player['inventory']['coins']/current['items'][command]['price'] ), debug, player) try: qty = int(choice) except ValueError: #if it's not an integer qty = 0 #skips all the checking and asks for another response '''