All pastes #567553 Raw Edit

Miscellany

public python v1 · immutable
·published 2007-06-15 00:44 UTC
rendered paste body
#!/usr/bin/python#-*- coding: ISO-8859-1 -*-#script escrito por JimmySkull__module_name__ = "Big Letters"__module_version__ = "1.0"__module_description__ = "Criar um texto grande"import commandsimport timeimport sysimport xchatlists = ['nil', 'nil', 'nil', 'nil', 'nil']def getword(letra,x,fundo):	try:		Arq = '/home/jimmy/.xchat2/letters'		f = open (Arq, 'r')		try:			try:				S = f.readline()[:-1]				while not (S == letra):					S = f.readline()[:-1]					if S == "eof":						raise				C = 0				while C < 5:					if C == 4:						S = f.readline()[:-1]					else:						S = f.readline()[:-2]					lists[C] = lists[C] + S + fundo + ' '					C = C + 1			except:				print "Letra \"%s\" não encontrada" % (letra)		finally:			f.close()	except:		print "Erro ao carregar \"%s\"" % (Arq)	return 0def DoBig(palavra, texto, fundo):	try:		#print 'limpando'		i = 0		while i < 5:			lists[i] = ""			i = i + 1		#print 'getwords'		PalLen = len(palavra)		i = 0		while i < PalLen:			getword(palavra[i:i+1],i,fundo)			i = i + 1		#print 'send'		i = 0		while i < 5:			lists[i] = lists[i].replace('b', fundo) # "b" de branco			lists[i] = lists[i].replace('p', texto) # "p" de preto			lists[i] = lists[i].strip('\n\r')			xchat.command("say %s" % (lists[i]))			i = i + 1	except IndexError:		print "Erro ao criar big letter"		return xchat.EAT_ALL	return xchat.EAT_ALLdef ValidarCor(valor):	if valor in ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'):		return True	else:		return Falsedef Big(word, word_eol, userdata):	try:		palavra = word[1].lower()	except IndexError:		print "Nenhuma palavra foi especificada. /big <palavra>"		return xchat.EAT_ALL       	return DoBig(palavra, '1,1', '0,0')def BigEx(word, word_eol, userdata):	try:		Cor1 = word[1]		Cor2 = word[2]		Pal  = word[3]		if not ValidarCor(Cor1):			raise		if not ValidarCor(Cor2):			raise		Cor1 = "%s,%s" % (Cor1,Cor1)		Cor2 = "%s,%s" % (Cor2,Cor2)	except IndexError:		print "Uso correto: /big <Cor da letra[0..15]> <Cor do fundo[0..15]> <palavra>"		return xchat.EAT_ALL       	return DoBig(Pal, Cor1, Cor2)xchat.hook_command("big", Big, help="/big palavra")xchat.hook_command("bigex", BigEx, help="/bigex <Cor da letra> <Cor do fundo> <palavra>")#----------------------------------------------------------------0b p....b p..b  p..p..b  p..p..b  p..b p....b 1b p..p...b p..b p..b p..2b p.....b p..b   p..b    p..b b   p..b  b p......3b p.....b p..b   p..b    p..b p..b   p..b p.....b 4p..b p..p..b p..p..... b   p..b   p..5p.....p..b   p....b b   p..p....b 6p.....p..b   p.....p..b p..p.....7p.....b   p..b  p...b   p..b   p..8b p....b p..b  p..b p....b p..b  p..b p....b 9b p.....p..b  p..b p.....b    p..b    p..!p..p..p..b.. p..?b p....b p..b  p..b   p..b b  p..b  b  p..b  ab p...b p.b   p.p.....p.....p.b   p.bp.....b p..b  p..p.....b p..b  p..p.....bcb p.....p..b    p..b    p..b    b p.....dp....b  p..b p..b p..b  p..p..b p..b p....b ep.......p..b     p.....b  p..b     p.......fp......p..b    p..... p..b    p..b    gb p.....p..b    p..b p...p..b  p..b p....b  hp..b  p..p..b  p..p......p..b  p..p..b  p..ip..b..p..p..p..jb  p....b   p..b b   p..b p..b p..b b p...b  kp..b  p..p..b p..b p....b  p..b p..b p..b  p..lp..b    p..b    p..b    p..b    p......mp..b     p...p....b  p....p..b p....b p..p..b  p..b  p..p..b      p..np..b   p..p....b p..p..b p....p..b  p...p..b   p..ob p.....b p..b   p..p..b   p..p..b   p..b  p....b pp.....b p..b  p..p.....b p..b    p..b    qp......b p..b  p..b p..b  p..b p..b  p..b p.......rp....b p..b p..p....b p..b p..p..b p..sp.....p..b   p.....b   p..p.....tp......b  p..b  b  p..b  b  p..b  b  p..b  up..b  p..p..b  p..p..b  p..p..b  p..b p....b vp..b  p..p..b  p..p..b  p..p..b  p..b p..b  wp..b p..b p..p..b p..b p..p..b p..b p..b p..b  p..b xp..b   p..b p..b p..b b  p...b  b p..b p..b p..b   p..yp..b  p.. b p....b  b  p..b   b  p..b   b  p..b   zp.......b   p..b  b p..b    p......._b       b       b       b       p.......-b       b       p.......b       b       eof#-----------------------------------------