Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Random name generator by PXYC
- To add syllables:
- Add to the list of syllables (namelist)
- Make sure it is in quotes and has a comma after it.
- ---
- To change the syllables, just change it in the list
- Enjoy! Don't post anywhere else without giving me credit! Thanks!
- """
- import shutil # Import module to move the file if it isn't in the AoSDir
- import os # Import module to check if it's in the AoSDir
- import sys # Import module to check current directory
- import time # Sleep
- import ConfigParser # Import the module to parse dat config
- from random import choice, randint # Import the function to pick a syllable
- clantag1 = [
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U", #This is getting annoying to type
- "V",
- "W",
- "X",
- "Y",
- "Z"
- ]
- syl1 = [
- "Da",
- "Di",
- "Do",
- "Er",
- "Et",
- "En",
- "Ev",
- "Da",
- "Mi",
- "Est",
- "Os",
- "Ta",
- "Mos",
- "Ye",
- "Yi",
- "Za",
- "Zo",
- "Te",
- "Yap",
- "Moz",
- "Yot",
- "Yit",
- "Stu",
- "Mor",
- "Dan",
- "Fas",
- "Dul",
- "Fan",
- "Ho",
- "Doy",
- "Far",
- "Kor",
- "Fad",
- "Dat",
- "Fis",
- "Art",
- "Ant",
- "Ara",
- "Aft",
- "Ana",
- "Asa"
- ]
- syl2 = [
- "st",
- "ne",
- "re",
- "ta",
- "fa",
- "de",
- "ta",
- "do",
- "in",
- "ta",
- "ny",
- "st",
- "yo",
- "ak",
- "ey",
- "eh",
- "en",
- "et",
- "un",
- "ud",
- "us"
- ]
- syl3 = [
- "a",
- "b",
- "c",
- "d",
- "e",
- "f",
- "g",
- "h",
- "i",
- "j",
- "k",
- "l",
- "m",
- "n",
- "o",
- "p",
- "r",
- "s",
- "t",
- "u",
- "v",
- "w",
- "x",
- "y",
- "z",
- "an",
- "ra",
- "ts",
- "fs",
- "ad",
- "st",
- "ra"
- ]
- def generate():
- syll1 = choice(syl1)
- syll2 = choice(syl2)
- syll3 = choice(syl3)
- syllist1 = list(syll1)
- syllist2 = list(syll2)
- syllist3 = list(syll3)
- if syllist1[len(syllist1) - 1] == syllist2[0] or syllist2[len(syllist2) - 1] == syllist3[0]: # Check if awkward looking name like Esttat
- generate() # redo
- else:
- global name
- numclan = randint(1, 4)
- if numclan == 4:
- clantag = choice(clantag1) + choice(clantag1) + choice(clantag1)
- name = "[" + clantag + "]" + syll1 + syll2 + syll3
- else:
- name = syll1 + syll2 + syll3
- def checkaosdir():
- if not os.path.isfile('config.ini'): # Checks if a config.ini exists where the file is.
- return False
- else:
- return True
- def setname():
- generate()
- parser = ConfigParser.SafeConfigParser() # blahblah
- parser.read('config.ini') # Read config.ini
- parser.set('client', 'name', '%s' % (name)) # Set the name
- parser.write(open('config.ini', 'w')) # Then save the INI file to config.ini
- newname = parser.get('client', 'name') + "." # Get the new name
- print "Success! New name is " + newname # Confirm new name
- time.sleep(1) # Close the window in 1 second
- if checkaosdir() is False:
- print "Put it in your Ace of Spades directory!" # Alert
- pathtoaos = raw_input('Enter path to AoS: ') # Prompts the user for path to Ace of Spades directory
- curpath = sys.argv[0] # Gets current path of the program
- if os.path.isfile('%s\\namegenerator.exe' % (pathtoaos)): # If a namegenerator.exe already exists:
- os.remove('%s\\namegenerator.exe' % (pathtoaos)) # Delete it, making room for a new one
- elif os.path.isfile('%s\\namegenerator.py' % (pathtoaos)): # If a namegenerator.py already exists:
- os.remove('%s\\namegenerator.py' % (pathtoaos)) # Delete it, making room for a new one
- shutil.move(curpath, pathtoaos) # Moves the program to your Ace of Spades directory
- print "Done. Copied to Ace of Spades directory. Run from there to generate a name." # Confirmation
- time.sleep(1) # Close in 1 second
- else:
- setname()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement