Midkemia gauges

Post Reply
Funkymatic
Posts: 8
Joined: Mon Dec 21, 2009 11:14 pm

Midkemia gauges

Post by Funkymatic »

I've butchered a couple of the available gauges/healthbar scripts that are available in the Scripts section of this forum and attempted to make them work with Midkemia Online.

I'm currently having a problem where the text overlay is not displaying properly. It displays for the 'Health' bar, but none of the others.

My trigger is set to capture on:
^(\d+)h, (\d+)e, (\d+)f, (\d+)m, (\d+)g \w*-$
^(\d+)h, (\d+)e, (\d+)f, (\d+)m, (\d+)g \w* A:\d+% - .*: \w+ -$
and does...
health = tonumber( matches[2] )
endurance = tonumber( matches[3] )
faith = tonumber( matches[4] )
magic = tonumber( matches[5] )
guile = tonumber( matches[6] )
updateGauges()
function gaugesstartup()
createLabel("maxHealth",250,WindowHeight-200,100,22,0);
setBackgroundColor("maxHealth",255,0,0,255)
createLabel("healthBar",250,WindowHeight-200,100,22,0);
setBackgroundColor("healthBar",0,155,0,255)

createLabel("maxEndurance",250,WindowHeight-170,100,22,0);
setBackgroundColor("maxEndurance",255,0,0,255)
createLabel("enduranceBar",250,WindowHeight-170,100,22,0);
setBackgroundColor("enduranceBar",0,155,0,255)

createLabel("maxFaith",250,WindowHeight-140,100,22,0);
setBackgroundColor("maxFaith",255,0,0,255)
createLabel("faithBar",250,WindowHeight-140,100,22,0);
setBackgroundColor("faithBar",0,155,0,255)

createLabel("maxMagic",250,WindowHeight-110,100,22,0);
setBackgroundColor("maxMagic",255,0,0,255)
createLabel("magicBar",250,WindowHeight-110,100,22,0);
setBackgroundColor("magicBar",0,155,0,255)

createLabel("maxGuile",250,WindowHeight-80,100,22,0);
setBackgroundColor("maxGuile",255,0,0,255)
createLabel("guileBar",250,WindowHeight-80,100,22,0);
setBackgroundColor("guileBar",0,155,0,255)
end

function updateGauges()
resizeWindow("healthBar",(100/maxHealth)*health,22)
echoUserWindow("healthBar", "H: " .. health .. "/" .. maxHealth )

resizeWindow("enduranceBar",(100/maxEndurance)*endurance,22)
echoUserWindow("enduranceBar", "E: " .. endurance .. "/" .. maxEndurance )

resizeWindow("faithBar",(100/maxFaith)*faith,22)
echoUserWindow("faithBar", "F: " .. faith .. "/" .. maxFaith )

resizeWindow("magicBar",(100/maxMagic)*magic,22)
echoUserWindow("magicBar", "M: " .. magic .. "/" .. maxMagic )

resizeWindow("guileBar",(100/maxGuile)*guile,22)
echoUserWindow("guileBar", "G: " .. guile .. "/" .. maxGuile )
end
I'm totally stumped.

Elriond
Posts: 6
Joined: Wed Dec 23, 2009 12:16 am

Re: Midkemia gauges

Post by Elriond »

I think i saw this somewhere else in the forum about gauges. Basically the mana text disappears as you use mana(for example). From what i've read you need to use a third layer of labels to put the text on, and set the transparency on those layers to 0, so you have an overlay of text on top of the gauges as the color shrinks/etc.

For example:
createLabel("guileTxt",250,WindowHeight-80,100,22,0);
setBackgroundColor("guileTxt",0,0,0,0)


resizeWindow("guileBar",(100/maxGuile)*guile,22)
echo("guileTxt", "G: " .. guile .. "/" .. maxguile )

Edit: echoUserWindow() is outdated now, use echo() instead.

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

Re: Midkemia gauges

Post by Vadi »

Yeah... I'd also just use the createGauge and etc. helper functions

Post Reply