Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Random name generator by PXYC
- Small modifications by rakiru
- 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 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
- from optparse import OptionParser
- uppercase = [
- "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",
- "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(generateClan):
- 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
- name = syll1 + syll2 + syll3
- if generateClan:
- clantag = choice(uppercase) + choice(uppercase) + choice(uppercase)
- name = "[" + clantag + "]" + name
- def checkaosdir(path):
- if not os.path.isfile('%s\\config.ini' % options.path): # Checks if a config.ini exists in the given location
- return False
- else:
- return True
- def setname(generateClan, aosPath):
- generate(generateClan)
- parser = ConfigParser.SafeConfigParser() # blahblah
- parser.read('%s\\config.ini' % (aosPath)) # 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
- ###START EXECUTION###
- parser = OptionParser()
- parser.add_option("-c", "--clan", dest="clan", default=False, metavar="CLAN", help="Generate clantag")
- parser.add_option("-p", "--path", dest="path", default=".", metavar="PATH", help="AoS path")
- (options, args) = parser.parse_args()
- if checkaosdir(options.path) is False:
- print "Please run this from your Ace of Spades directory, or specify the path to use via command-line." # Alert the user to the problem
- time.sleep(1)
- else:
- setname(bool(options.clan), options.path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement