Verticle gauges (v0.1)

Share your scripts and packages with other Mudlet users.
Post Reply
naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Verticle gauges (v0.1)

Post by naftali »

I wanted a set of function to make and use vertical gauges the same way the current one makes horizontal gauges, so I started writing one. What I have does some of what the Gauge functions do, but I haven't figured out how to do the rest. Here's what I have so far:

createVGauge() - makes the same output as createGauge(), only with a vertical gauge instead of horizontal. Don't know if it will need to be changed to make everything else work.
setVGauge() - would work just like setGauge() if I knew how to get the dimensions of a previously created label. Does such a thing exist?
Also need to figure out how to make moveWindow() handle this correctly.

here's the code of what I got. Looking for help finishing this up, since I suspect that what I've got isn't going to work without significant changes, even ignoring what still needs to be added.
Code: [show] | [select all] lua
function createVGauge(name, height, width, posX, posY, color1, color2, color3)
	local bglabel = name .. "Bg"
	local fglabel = name .. "Fg"
	local r = tonumber(color1) or color_table[color1][1]
	local g = tonumber(color2) or color_table[color1][2]
	local b = tonumber(color3) or color_table[color1][3]
	createLabel(bglabel, posX, posY, width, height,1)
	setBackgroundColor(bglabel, r, g, b, 100)
	createLabel(fglabel, posX, posY, width, height,1)
	setBackgroundColor(fglabel, r, g, b, 255)
end

function setVGauge(name, current, max)
	local bglabel = name .. "Bg"
	local fglabel = name .. "Fg"
	local ratio = current / max
	local height = getWindowSize(bglabel)[2] * ratio
	local width = getWindowSize(bglabel)[1]
	resizeWindow(fglabel, width, height)
end

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: Verticle gauges (v0.1)

Post by demonnic »

I haven't used gauges in awhile, but I thought vertical gauges were added as an option to the current function for creating gauges in 1.0.5.. though I could have been thinking one of the latest slew of pre release test versions

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Verticle gauges (v0.1)

Post by naftali »

demonnic wrote:I haven't used gauges in awhile, but I thought vertical gauges were added as an option to the current function for creating gauges in 1.0.5.. though I could have been thinking one of the latest slew of pre release test versions
Has yet to show up in the documentation, and I couldn't find it in luaGlobal.lua

guy
Posts: 26
Joined: Wed Mar 03, 2010 5:41 am
Location: Seattle

Re: Verticle gauges (v0.1)

Post by guy »

Naftali,

I'm working on a windowing system for Mudlet that will make your job of creating vertical gauges much easier. Give me a couple more days to get all the bugs out and the documentation written.

- guy

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Verticle gauges (v0.1)

Post by Vadi »

I'm actually quite keen to see it.

naftali
Posts: 138
Joined: Wed Jan 20, 2010 8:42 pm

Re: Verticle gauges (v0.1)

Post by naftali »

me too. I've seen you talk about it elsewhere, so I expect the coolest thing about your system won't be vertical gauges :D

Post Reply