Skip to content

Instantly share code, notes, and snippets.

@Wunkolo
Created June 22, 2014 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Wunkolo/b4ce8c585f50dce79b9c to your computer and use it in GitHub Desktop.
Save Wunkolo/b4ce8c585f50dce79b9c to your computer and use it in GitHub Desktop.
HexChat python scripts
import xchat, re, random
import string
__module_name__ = "Noise"
__module_version__ = "1.0.0"
__module_description__ = "Generates random colored string of the length specified"
def RandomWord(Length):
charlist = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&\'()*+,-./:;<=>?@[\]^_`{|}~"
word = ""
for i in range(Length):
word += (randcolor() + charlist[random.randint(0,len(charlist)-1)])
return word
def randcolor():
return ("\x02" if random.randint(0,1) == 1 else "") + ("\x1D" if random.randint(0,1) == 1 else "") + ("\x1F" if random.randint(0,1) == 1 else "") + "\x03" + str(random.randrange(2,15)) + "," + str(random.randrange(2,15))
def noise(word,word_eol,userdata):
length = 32
if len(word) > 1:
try:
length = int(word[1])
except ValueError:
length = 32
(xchat.get_context()).command("say "+RandomWord(length))
xchat.hook_command("n",noise,help="/n (number)")
print "Noise script by DEElekgolo loaded. use \\n (number) to generate colored text noise"
import xchat, re
import string
__module_name__ = "Rainbow"
__module_version__ = "1.0.0"
__module_description__ = "Generates rainbow colored versions of the text you enter. Post it for the specified line-count"
def Rainbow(text,offset):
colorlist = ["\x034","\x037","\x038","\x039","\x0311","\x0312","\x0313","\x036","\x034"]
rainbowed = ""
for i in xrange(len(text)):
rainbowed += (colorlist[(i+offset)%len(colorlist)] + text[i])
return rainbowed
def rainbowcmd(word,word_eol,userdata):
count = 6
text = ""
if len(word) > 1:
try:
text = word[1]
except ValueError:
text = ""
if len(word) > 2:
try:
count = int(word[2])
except ValueError:
count = 6
for i in xrange(0,count):
(xchat.get_context()).command("say "+Rainbow(text,i))
xchat.hook_command("r",rainbowcmd,help="/r (text) (line count)")
print "Rainbow script by DEElekgolo loaded. use \\r (text) (count) to generate rainbow-ed text"
@Futzy
Copy link

Futzy commented Jun 22, 2014

wow

@ScottSteiner
Copy link

I forked rainbow.py and edited it a bit to make it python3 compatible, smaller, easier to modify (the colors) and to allow strings with multiple words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment