Color Miniconsole

Share your scripts and packages with other Mudlet users.
Post Reply
icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Color Miniconsole

Post by icesteruk »

If you wish to track enemies Afflictions in a miniconsole and have it be in different color depending on the affliction this is how I do it
Code: [show] | [select all] lua
enemyAffshow = function()

clearWindow("GUI.enemyaffsConsole")

local enemyaff_highlights = {
		confusion = "yellow",
stupidity = "yellow",
		paralysis = "green",
aeon = "red",
clumsiness = "red",
		impatience = "orange",
		slickness = "cyan",
		asthma = "cyan",
		limpveins = "cyan",
		anorexia = "cyan",
	crippled = "purple",
crippledbody = "purple",
mentaldisruption = "purple",
physicaldisruption = "purple",
		leftlegbroken = "orange",
		rightlegbroken = "orange",
		leftlegdamaged = "dark_orange",
		rightlegdamaged = "dark_orange",
		leftlegmangled = "orange_red",
		rightlegmangled = "orange_red",		
		leftarmbroken = "PaleGreen",
		rightarmbroken = "PaleGreen",
		leftarmdamaged = "green",
		rightarmdamaged = "green",
		leftarmmangled = "ForestGreen",
		rightarmmangled = "ForestGreen",
		headdamaged = "light_sky_blue",
		headmangled = "dodger_blue",
		torsodamaged = "light_sky_blue",
		torsomangled = "dodger_blue",
		
	}

	local enemyaff_ignore = {
		"bulimia",
		"amnesia",
	}

	

local enemyaffs = {}
	
	for k,v in pairsByKeys(combat.afflictions) do
		if v and not table.isMember(enemyaff_ignore, k) then
			local enemyaff_color = enemyaff_highlights[k] and ("<" .. enemyaff_highlights[k] .. ">") or ""
			table.insert(enemyaffs, enemyaff_color .. k .. "<red>")
		end
end
cecho("GUI.enemyaffsConsole", "Enemy!\n\n")
	for i=1,#enemyaffs,1 do
cecho("GUI.enemyaffsConsole", "<white>" .. enemyaffs[i])
echo("GUI.enemyaffsConsole", ", ")
echo("GUI.enemyaffsConsole", string.rep(" ", (6-#enemyaffs[i])))
	end
end
the 'combat.afflictions' is my variable which is ""paralysis" = true, "stupidity" = true"" .. and so on

the 'GUI.enemyaffsConsole' is the name of my console and this is how I created that
Code: [show] | [select all] lua
GUI.enemyaffsConsole = Geyser.MiniConsole:new({
		name = "GUI.enemyaffsConsole",
  x = "4%", y = "53%",
  width = "42%",
  height = "44%",
color = "black",
},GUI.Right)

GUI.enemyaffsConsole:setWrap(math.floor(GUI.enemyaffsConsole.get_width() / fontx))

-- Enemy Affs Console Finished
The size is set to fix into the Template that Akayn posted in this TOPIC, Enjoy!

Post Reply