Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # In this one I want to create a full character, using the following example
- # as characteristics:
- charVyasa = {'name':'Vyasa',
- 'password':'mypassword',
- 'race':'elf',
- 'gender':'male',
- 'adj1':'venerable',
- 'adj2': 'long-bearded',
- 'height':'tall',
- 'weight':'skinny',
- 'mortal-level':'myth'}
- # For this, the only function I'll have to change is charCreate()
- # We keep the charsAvailable dictionary for login, but we create an individual one
- # for each char with their characteristics
- charsAvailable = {'vyasa':'mypassword',
- 'dhez':'mypassword',
- 'destre':'mypassword'}
- # -----------------------> Functions <-----------------------
- # Login with a char passed to this
- def charLogin(name):
- if name in charsAvailable.keys():
- passw = input('Welcome ' + name.title() + '. Please enter your password: ')
- if passw == charsAvailable[name]:
- print('Welcome back ' + name.title() + '.')
- else:
- for i in range(1,4):
- passtry = input('Chance ' + str(i) + ' out of 3. Please enter your password again: ')
- if passtry == charsAvailable[name]:
- print('Welcome back ' + name.title() + '.')
- break
- else:
- print('Wrong password.')
- else:
- print('\nThere is no character by that name. Returning to login screen\n')
- welcomeScreen()
- # Creates a new char and adds it to the dictionary
- # Creates a dictionary with individual characteristics. Can also be expanded
- # to present the user with a list of options to choose from instead of entering them
- # on his own, since he may well mess it up ;-)
- # For now, we still need to fix it with a lot of try/excepts
- def charCreate():
- global newChar
- newChar = {'mortal-level':'beginner'}
- NewcharName = input('Please select a name for your character: ')
- newChar['name'] = NewcharName
- newCharPassword = input('Your name will be ' + newChar['name'].title() + '. Please choose a password: ')
- newChar['password'] = newCharPassword
- newChar['race'] = input('Please choose a race for your character: ')
- newChar['gender'] = input('Please choose a gender for your character: ')
- newChar['adj1'] = input('Please choose a word to describe your character: ')
- newChar['adj2'] = input('Please choose another word to describe your character: ')
- newChar['height'] = input('Please tell me how tall your character is: ')
- newChar['weight'] = input('Please choose how fat or skinny your character is: ')
- charsAvailable[NewcharName] = newChar['password']
- print('Account created.')
- print('You are a ' + newChar['adj1'] + ' ' + newChar['adj2'] + ' ' + newChar['race'] + '. Presenting yourself as: \n' + str(newChar['name']).title() + ' ' + newChar['mortal-level'] + ', ' + newChar['gender'] + ' ' + newChar['race'] + '\n')
- print('You may now login with your new character.\n')
- welcomeScreen()
- # The welcome screen from which we go
- def welcomeScreen():
- print('Welcome to Genesis.')
- choice = input('Please enter your name or type \'new\' to create a new character: ')
- if choice.isalpha() == False:
- print('Names may only contain letters')
- welcomeScreen()
- elif choice == 'new':
- charCreate()
- else:
- charLogin(choice)
- welcomeScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement