Skip to content

Instantly share code, notes, and snippets.

@chyyran
Created April 18, 2013 00:59
Show Gist options
  • Save chyyran/5409035 to your computer and use it in GitHub Desktop.
Save chyyran/5409035 to your computer and use it in GitHub Desktop.
Makes Minecraft color codes into mIRC color codes
#coding=utf-8
__author__ = 'ron975'
def ingame_toIRC(string):
string = string.decode("utf-8")
#Black to Black
string = string.replace(u"\u00A7"+"0", u"\u0003"+"01")
#Ingame Dark Blue to IRC Blue
string = string.replace(u"\u00A7"+"1",u"\u0003"+"02")
#Ingame Dark Green to IRC Dark Green
string = string.replace(u"\u00A7"+"2",u"\u0003"+"03")
#Ingame Dark Aqua to IRC Teal
string = string.replace(u"\u00A7"+"3",u"\u0003"+"10")
#Ingame Dark Red to IRC Maroon
string = string.replace(u"\u00A7"+"4",u"\u0003"+"05")
#Ingame Purple to IRC Purple
string = string.replace(u"\u00A7"+"5",u"\u0003"+"06")
#Ingame Gold to IRC Orange
string = string.replace(u"\u00A7"+"6",u"\u0003"+"07")
#Ingame Gray to IRC LightGray
string = string.replace(u"\u00A7"+"7",u"\u0003"+"15")
#Ingame DarkGray to IRC Gray
string = string.replace(u"\u00A7"+"8",u"\u0003"+"14")
#Ingame Blue to IRC Lightblue
string = string.replace(u"\u00A7"+"9",u"\u0003"+"12")
#Ingame Green to IRC LightGreen
string = string.replace(u"\u00A7"+"a",u"\u0003"+"09")
#Ingame Aqua to IRC Cyan
string = string.replace(u"\u00A7"+"b",u"\u0003"+"11")
#Ingame Red to IRC Red
string = string.replace(u"\u00A7"+"c",u"\u0003"+"04")
#Ingame light purple to IRC light purple
string = string.replace(u"\u00A7"+"d",u"\u0003"+"13")
#Ingame yellow to IRC yello
string = string.replace(u"\u00A7"+"e",u"\u0003"+"08")
#Ingame White to IRC White
string = string.replace(u"\u00A7"+"f",u"\u0003"+"00")
#Ingame Bold to IRC Bold
string = string.replace(u"\u00A7"+"l",u"\u0002")
#Ingame Strikethrough to nothing
string = string.replace(u"\u00A7"+"m",'')
#Ingame Underline to IRC underline
string = string.replace(u"\u00A7"+"n",u"\u001F")
#Ingame ital to IRC ital
string = string.replace(u"\u00A7"+"o",u"\u0016")
#Ingame garbled to nothing
string = string.replace(u"\u00A7"+"k","")
newstr = string
return newstr
print ingame_toIRC("§lHello World")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment