# coding: utf-8 # Big Text v2.1.2 # Generates text five lines tall. # By William W. <wildbill AT purezc DOT com> # License: GPL # Options # These are your starting options, and can be temporarily # remembered by passing :! to the command options = { # Font: normal, bold 'font': 'normal', # Output command 'command': 'say', # Inversion: False -> off, True -> on 'invert': False, # Colors: False -> off, [['1','2','3'],['1','2','3']] -> chosen colors 'colors': False, # Go back through colors instead of just looping: False -> off, True -> on 'rewind': False, # Cycle multiple colors by 0 -> line, 1 -> letter, 2 -> line 'cycle': 0, # Keep the cycle open across lines, even if coloring by letter/word: False -> off, True -> on 'keepcycle': False, # Don't skip spaces in alternation: False -> off, True -> on 'spaces': False, # Flipped vert: False -> off, True -> on 'flip': False, # Flipped horiz: False -> off, 1 -> string, 2 -> letters 'reverse': False } # #/b Cheese! # Simply a big "Cheese!" #/b :m moos. # An action whereby you "moo" in big text #/b :c4 Burn! # "Burn!" in red text (where 4 is red by standard mIRC colors) #/b :c4,8 :c8,4 Ew! # Alternative colors by line; red on yellow, then yellow on red #/b :l :c4,,5 :c8,,7 :c9,,3 :c12,,2 :c13,,6 Rainbow! # "Rainbow" text colorized by letter (see sample image) # Python seems to be incapable of getting control codes right # by ASCII value, so here they are: # Bold: \2 # Underline: \31 # Reverse: \22 # Color: \3 # Normal: \15 # Space: || \xa0 import xchat, re, random __module_name__ = "Big Text" __module_version__ = "2.1.2" __module_description__ = "Generates text five lines tall." characters = { 'A': ['2112', '101', '111', '101', '101'], 'a': ['2112', '001', '2113', '101', '2311'], 'B': ['1132', '101', '1132', '101', '1132'], 'b': ['100', '100', '1132', '101', '1132'], 'C': ['23132', '101', '100', '101', '2112'], 'c': ['002', '2313', '102', '102', '2313'], 'D': ['110', '12332', '101', '101', '1132'], 'd': ['001', '001', '2311', '101', '2311'], 'E': ['111', '100', '1132', '100', '111'], 'e': ['2112', '101', '111', '100', '2112'], 'F': ['111', '100', '1132', '100', '100'], 'f': ['011', '2120', '3112', '2120', '2120'], 'G': ['2112', '100', '1231', '101', '2112'], 'g': ['2311', '101', '2113', '001', '2112'], 'H': ['101', '101', '111', '101', '101'], 'h': ['100', '100', '1132', '101', '101'], 'I': ['111', '010', '010', '010', '111'], 'i': ['1', '0', '1', '1', '1'], 'J': ['001', '001', '001', '101', '2112'], 'j': ['001', '000', '001', '101', '2112'], 'K': ['121', '112', '1322', '112', '121'], 'k': ['102', '102', '121', '112', '121'], 'L': ['100', '100', '100', '100', '111'], 'l': ['1', '1', '1', '1', '1'], 'M': ['21212', '1113', '12321', '1021', '1021'], 'm': ['0002', '21212', '1113', '12321', '12321'], 'N': ['101', '1321', '111', '1231', '101'], 'n': ['000', '1132', '101', '101', '101'], 'O': ['2112', '101', '101', '101', '2112'], 'o': ['000', '23132', '101', '101', '23132'], 'P': ['1132', '101', '1132', '100', '100'], 'p': ['000', '1132', '101', '1132', '100'], 'Q': ['2110', '1012', '1012', '1012', '21123'], 'q': ['000', '2311', '101', '2311', '001'], 'R': ['1132', '101', '1132', '101', '101'], 'r': ['000', '23132', '101', '100', '100'], 'S': ['2311', '100', '2112', '001', '1132'], 's': ['002', '031', '210', '012', '130'], 'T': ['111', '010', '010', '010', '010'], 't': ['010', '111', '010', '010', '010'], 'U': ['101', '101', '101', '101', '2112'], 'u': ['000', '101', '101', '101', '2311'], 'V': ['1021', '1021', '1021', '21212', '0130'], 'v': ['2000', '1021', '1021', '21212', '0130'], 'W': ['1021', '1021', '12321', '1113', '21212'], 'w': ['0002', '1021', '12321', '1113', '21212'], 'X': ['101', '101', '2112', '101', '101'], 'x': ['000', '101', '2112', '2112', '101'], 'Y': ['101', '101', '2112', '010', '010'], 'y': ['000', '1221', '2112', '2210', '3102'], 'Z': ['111', '0212', '010', '2120', '111'], 'z': ['200', '311', '012', '210', '311'], '0': ['2112', '101', '1231', '1321', '2112'], '1': ['010', '2310', '010', '010', '111'], '2': ['2310', '0212', '2112', '100', '111'], '3': ['1132', '001', '2112', '001', '1132'], '4': ['101', '101', '111', '001', '001'], '5': ['111', '100', '1132', '001', '1132'], '6': ['2112', '100', '1132', '101', '2112'], '7': ['111', '001', '0212', '010', '010'], '8': ['2112', '101', '2112', '101', '2112'], '9': ['2112', '101', '2311', '001', '2112'], '/': ['001', '0212', '010', '2120', '100'], '\\': ['100', '2120', '010', '0212', '001'], '|': ['1', '1', '0', '1', '1'], '-': ['000', '000', '111', '000', '000'], '=': ['000', '111', '000', '111', '000'], '+': ['000', '010', '111', '010', '000'], '?': ['2112', '101', '0212', '000', '0212'], '!': ['1', '1', '1', '0', '1'], '(': ['011', '2120', '100', '2120', '011'], ')': ['110', '0212', '001', '0212', '110'], '`': ['212', '01', '00', '00', '00'], '*': ['000', '010', '111', '23032', '000'], '^': ['010', '23032', '000', '000', '000'], '%': ['101', '0212', '010', '2120', '101'], '#': ['23032', '111', '23032', '111', '23032'], '~': ['0000', '21301', '12112', '0000', '0000'], '$': ['2110', '12302', '21132', '02321', '1112'], '@': ['2112', '101', '1231', '100', '2112'], '&': ['21102', '1010', '21121', '10132', '21121'], '[': ['11', '10', '10', '10', '11'], ']': ['11', '01', '01', '01', '11'], '{': ['2311', '2120', '100', '2120', '2311'], '}': ['1132', '0212', '001', '0212', '1132'], '<': ['0031', '0130', '3100', '0130', '0031'], '>': ['1300', '0310', '0013', '0310', '1300'], '_': ['000', '000', '000', '000', '111'], "'": ['212', '10', '00', '00', '00'], '"': ['101', '23032', '000', '000', '000'], ':': ['0', '1', '0', '1', '0'], ';': ['212', '00', '00', '212', '10'], '.': ['0', '0', '0', '0', '1'], ',': ['00', '00', '00', '212', '10'], ' ': ['02', '02', '02', '02', '02'] } fonts = { 'normal': ['EE', 'SFF', 'E', 'SF', 'E'], # Whole empty, whole full, half empty, half full, between characters 'bold': ['EEEE', 'SFFFF', 'EE', 'SFF', 'EE'] } options_def = {'font': 'normal', 'command': 'say', 'invert': False, 'colors': False, 'rewind': False, 'cycle': 0, 'keepcycle': False, 'spaces': False, 'flip': False, 'reverse': False} options_local = {'font': 'normal', 'reverse': random.choice([False, 1, 2]), 'invert': False, 'flip': random.choice([True, False]), 'colors': [['4', '', '5'], ['8', '', '7'], ['9', '', '3'], ['12', '', '2'], ['13', '', '6']], 'spaces': False, 'command': 'echo', 'cycle': 1, 'keepcycle': random.choice([True, False]), 'rewind': False} usage = 'Usage: B [:!] [:m/:e/:<command>:] [:b] [:i/:c<fg>[,[<bg>][,<shadow>]] [:l/:w [:s] [:k]] [:rw]] [:f] [:r/:rl] <text>' def generate(text): global characters bigged = '' big = [[],[],[],[],[]] end = '4' for i, l in enumerate(list(text)): if i + 1 == len(text): end = '' if characters.has_key(l): bigged += l set = characters[l] for line in range(0, 5): big[line] += [set[line] + end] return [bigged, big] def draw(text, config): if len(text) < 1: return 0 global xchat, fonts opts = config chars = fonts[config['font']] # Tweaks for reversal if opts['reverse'] == 2: text = text[::-1] # Generate the text bigged, big = generate(text) # More reversal tweaks if opts['reverse']: bigged = bigged[::-1] # Flipped if opts['flip']: big.reverse() # Rewind colors if opts['rewind'] and type(opts['colors']) is list and len(opts['colors']) > 2: opts['colors'] += opts['colors'][::-1][1:-1] c = 0 # Starting color for line in big: # Interpret our drawing drawn = [] for part in line: draw = '' for p in part: if int(p) in range(0, 5): draw += chars[int(p)] else: print "Invalid character found in character mapping: " + p return 0 drawn += [draw] # Output it if drawn: prefix = '' # Used for inversion # Reversed if opts['reverse']: drawn = '!'.join(drawn)[::-1].split('!') # Color... this stuff makes my brain hurt if opts['colors']: # Determine what we join by based upon shadow joiner = '' if len(opts['colors'][0]) == 3: joiner = chars[4] # Don't shift colors over spaces spaces = [] if not opts['spaces']: for i, l in enumerate(list(bigged)): if l == ' ': spaces += [i] # Not cycling colors by character or word if not opts['cycle'] or len(opts['colors']) <= 1: drawn = [joiner.join(drawn)] # Color by word; lots of crap to rechunk elif opts['cycle'] == 2: newdrawn = [] letters = [] spaces = [] for i, l in enumerate(list(bigged)): # My head asplode if l == ' ': if opts['spaces'] != 1: spaces += [len(newdrawn)] if letters != []: newdrawn += [joiner.join(letters)] newdrawn += [drawn[i]] letters = [] else: letters += [drawn[i]] if letters != []: newdrawn += [joiner.join(letters)] drawn = newdrawn[:] # Add some padding if we have a background color if opts['colors'][0][1] != '': drawn[0] = chars[4]+drawn[0] drawn[len(drawn)-1] += chars[4] for i, part in enumerate(drawn): # Shadowed if len(opts['colors'][c]) == 3: # Reversed text; pad accordingly if opts['reverse']: part += chars[4] else: part = chars[4]+part part = re.sub('ES|SE', ' 0,'+opts['colors'][c][2]+'D'+' ', part) # Get the colors to use and apply space = opts['colors'][c][:2] font = space[::-1] if space[1] == '': font = ['0', space[0]] space = 0 if space != 0: part = re.sub('(E+)', ' '+','.join(space)+r'\1 ', part) part = re.sub('(F+)', ' '+','.join(font)+r'\1 ', part) # FINALLY drawn[i] = part # Change the color if we're not on space if not opts['cycle'] or i not in spaces: if c + 1 < len(opts['colors']): c += 1 else: c = 0 # If we're chunking colors, reset if not opts['keepcycle'] and opts['cycle']: c = 0 # WHOO!!! drawn = ''.join(drawn) # Do not use color, thereby making life much easier else: drawn = re.sub('(F+)', r' \1 ', ''.join(drawn)) # Inversion if opts['invert']: drawn = 'E'+drawn+'E' prefix = ' ' # Remove shadow codes and convert our output drawn = drawn.replace('S', '') drawn = re.sub('[EDF]', '', drawn) xchat.command(opts['command']+' '+prefix+drawn) return 1 def bigtext(word, word_eol, userdata): global usage, options, options_default if len(word) == 1: print usage return xchat.EAT_XCHAT word = word_eol[0].split(' ') offset = 0 flag = True remember = False opts = options.copy() for w in word[1:]: offset += 1 if w == ':!' and offset == 1: remember = True opts = options_def.copy() elif w == ':b': opts['font'] = 'bold' elif w == ':m': opts['command'] = 'me' elif w == ':e': opts['command'] = 'echo' elif re.match('^:.+:$', w): command = {} for i, p in enumerate(w[1:-1].split('\\\\')): command[i] = [] for q in p.split('\\_'): command[i] += [q.replace('_', ' ')] command[i] = '_'.join(command[i]) opts['command'] = '\\'.join(command.values()) elif w == ':i': opts['invert'] = True elif re.match('^:c[0-9]+(,([0-9]+)?(,[0-9]+)?)?$', w): if opts['colors'] == 0: opts['colors'] = [] colors = w[2:].split(',') if len(colors) == 1: colors += [''] if opts['colors'] == [] or len(colors) == len(opts['colors'][0]): opts['colors'] += [colors] elif w == ':rw': opts['rewind'] = True elif w == ':l': opts['cycle'] = 1 elif w == ':w': opts['cycle'] = 2 elif w == ':k': opts['keepcycle'] = True elif w == ':s': opts['spaces'] = True elif w == ':f': opts['flip'] = True elif w == ':r': opts['reverse'] = 1 elif w == ':rl': opts['reverse'] = 2 elif w == ':': offset += 1 flag = False break else: flag = False break if flag or offset >= len(word): if remember: options = opts.copy() result = [] for opt in opts.keys(): result += [' 5'+opt+' : 7 '+str(opts[opt])] print ' Big Text options set: '+' ; '.join(result) else: print usage return xchat.EAT_XCHAT elif remember: options = opts.copy() draw(word_eol[offset], opts.copy()) return xchat.EAT_XCHAT xchat.hook_command("B", bigtext, help=usage) draw('BIG TEXT', options_local.copy()) print "Script loaded. Use /B for help."
xchat big text irc rainbow script
here is a fun big text x-chat irc script. this xchat plugin will make your text big and colorful.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment