Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- [[ TPTools ]]--
- -- by nucular, licensed under MIT
- --VER 0.1 UPDATE http://pastebin.com/raw.php?i=mgRkqLaT
- tptools = {}
- tptools.COLOR_TAGS = {
- -- Some color codes
- reset = 0x0E, r = 0x0E,
- invert = 0x01,
- white = "\bw",
- green = "\bg",
- yellow = "\bo",
- red = "\br",
- lred = "\bl",
- blue = "\bb",
- lblue = "\bt"
- }
- tptools.ICON_TAGS = {
- -- More or less complete map of the TPT font space!
- play = 128,
- open = 129,
- save = 130,
- tag = 131,
- signin = 132,
- delete = 133,
- -- 134 delete colors
- dropup = 135,
- -- 136 dropup colors
- add = 137,
- player = 138,
- -- 139 player colors
- -- 140 signin colors
- dot = 141,
- circle = 142,
- search2 = 143,
- pause = 144,
- reload = 145,
- new = 146,
- own = 147,
- -- 148 own colors
- right = 149,
- left = 150,
- amd = 151, -- relict from the first versions (lets finds the intel logo!)
- wind = 152,
- pressure = 153,
- persist = 154,
- fire = 155,
- -- 156 fire colors
- leftalign = 157,
- centeralign = 158,
- rightalign = 159,
- sign = 160, -- 161
- dropdown = 162,
- skylarkinati = 163,
- -- 164 skylarkinati colors
- oe = 165, -- used in the old TPT to draw some latin stuff
- date = 166,
- votes = 167,
- square = 168,
- resize = 169,
- cancel = 170,
- -- 171 unused
- lbrace = 172,
- rbrace = 173,
- -- 174?
- zero = 175, one = 176, two = 177, three = 178, four = 179, five = 180,
- six = 181, seven = 182, eight = 183, nine = 184,
- block = 185,
- -- 186
- -- 187 These three are used to draw the vote bars
- -- 188
- heat = 189,
- -- 190?
- blob = 191,
- -- 192 unused?
- walls = 193,
- electronics = 194,
- explosives = 195,
- liquids = 196,
- gasses = 197,
- radioactive = 198,
- shield = 199,
- smalldot = 200,
- -- 201 shield colors
- votedown = 202,
- voteup = 203,
- special = 204, favourite = 204,
- lock = 205,
- -- 206 lock colors
- check = 207, options = 207,
- powders = 208,
- solids = 209,
- life = 210,
- heatgrad = 211,
- -- 212 These two are the cracker air
- -- 213 display mode icon
- powered = 214,
- tools = 215,
- gradleft = 216,
- gradmiddle = 217,
- gradright = 218,
- block3 = 219, --?
- grid = 220,
- -- 221?
- lensing = 222,
- glow = 223,
- lifeval = 224,
- flare = 225,
- force = 226,
- warning = 227,
- deco = 228,
- search = 229,
- sample = 230
- -- 231 - 255 unused
- }
- function tptools.icon(name)
- return string.char(tptools.ICON_TAGS[name])
- end
- function tptools.text(text, tstart, tend)
- tstart = tstart or "{"
- tend = tend or "}"
- -- rgb
- text = text:gsub(tstart .. "(%d+),(%d+),(%d+)" .. tend, function(r, g, b)
- -- don't allow 0x00 or 0x100+
- r = math.max(math.min(r, 255), 1)
- g = math.max(math.min(g, 255), 1)
- b = math.max(math.min(b, 255), 1)
- return string.char(0x0F, r, g, b)
- end)
- text = text:gsub(tstart .. "(.-)" .. tend, function(c)
- local v = tptools.COLOR_TAGS[c] or tptools.ICON_TAGS[c]
- if not v then
- return nil
- end
- if type(v) ~= "string" then
- return string.char(v)
- else
- return v
- end
- end)
- return text
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement