Verticle gauges (v0.1)

Share your scripts and packages with other Mudlet users.

Verticle gauges (v0.1)

Postby naftali » Wed Mar 10, 2010 6:25 pm

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.

Syntax: [ Download ] [ Hide ]
Using lua Syntax Highlighting
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
naftali
 
Posts: 134
Joined: Wed Jan 20, 2010 8:42 pm

Re: Verticle gauges (v0.1)

Postby demonnic » Thu Mar 11, 2010 1:38 am

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
User avatar
demonnic
 
Posts: 161
Joined: Sat Dec 05, 2009 3:19 pm

Re: Verticle gauges (v0.1)

Postby naftali » Thu Mar 11, 2010 2:55 am

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
naftali
 
Posts: 134
Joined: Wed Jan 20, 2010 8:42 pm

Re: Verticle gauges (v0.1)

Postby guy » Sun Mar 14, 2010 9:45 am

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
guy
 
Posts: 26
Joined: Wed Mar 03, 2010 5:41 am
Location: Seattle

Re: Verticle gauges (v0.1)

Postby Vadi » Sun Mar 14, 2010 10:23 pm

I'm actually quite keen to see it.
User avatar
Vadi
 
Posts: 1034
Joined: Sat Mar 14, 2009 3:13 pm

Re: Verticle gauges (v0.1)

Postby naftali » Sun Mar 14, 2010 11:36 pm

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
naftali
 
Posts: 134
Joined: Wed Jan 20, 2010 8:42 pm


Return to Scripts & Packages

Who is online

Users browsing this forum: No registered users and 3 guests