Page 1 of 1
Gauges
Posted: Tue Jun 25, 2013 9:53 pm
by Jarrin
I'm trying to get a gauge to work using the Vyzor framework. I can't get it to display the gauge at all. Can someone take a look below and see what I'm missing? I tried to build this based around the gauges in Akayan's various UIs, but I'm messing something up.
function Gauges()
-- Set Values for Stats
health = tonumber(gmcp.Char.Vitals.hp)
mana = tonumber(gmcp.Char.Vitals.mp)
endo = tonumber(gmcp.Char.Vitals.ep)
will = tonumber(gmcp.Char.Vitals.wp)
maxhealth = tonumber(gmcp.Char.Vitals.maxhp)
maxmana = tonumber(gmcp.Char.Vitals.maxmp)
maxendo = tonumber(gmcp.Char.Vitals.maxep)
maxwill = tonumber(gmcp.Char.Vitals.maxwp)
tnl = tonumber(gmcp.Char.Vitals.nl)
---Gauges
HealthFrameBack = Vyzor.Frame( "HealthFrameBack", 0, .01, .4, .49 )
HealthFrameFront = Vyzor.Frame( "HealthFrameFront" )
HealthColorFront = Vyzor.Background( Vyzor.Brush( Vyzor.Image( imagePath .. "healthfill.png" ) ) )
HealthColorBack = Vyzor.Border( 5, Vyzor.BorderStyle.Solid, Vyzor.Brush( Vyzor.Image( imagePath .. "DFCHealth.png" ) ) )
HealthFrameBack:Add( HealthColorBack )
HealthFrameFront:Add( HealthColorFront )
health = tonumber(gmcp.Char.Vitals.hp)
maxhealth = tonumber(gmcp.Char.Vitals.maxhp)
HealthGauge = Vyzor.Gauge( "HealthGauge", "health", "maxhealth", HealthFrameBack, HealthFrameFront, BottomTop )
Vyzor.Right:Add( HealthGauge )
Vyzor.HUD:Draw()
echo("Vitals Updated")
end
Edits to fix changed code
Re: Gauges
Posted: Wed Jun 26, 2013 12:32 am
by Akaya
Here's a few things I've noticed that might help fix the problem:
To have the DFCHealth.png image appear, you'll want to define the imagePath variable. Adding this to the beginning of your script will do so:
imagePath = getMudletHomeDir():gsub("\\","/")
Then make sure your image is in your profile folder. You can see the directory of this folder by entering
lua getMudletHomeDir() from the command line.
The gaugefill enum in your Vyzor.Gauge isn't proper. The Vyzor documentation actually leaves the explanation out. Try this out instead:
HealthGauge = Vyzor.Gauge( "HealthGauge", "health", "maxhealth", HealthFrameBack, HealthFrameFront, Vyzor.GaugeFill.BottomTop )
The snippet you provided is a function, so you'll need to run it for it all to work. Try adding
Gauges() to the end of the script or run it from the command line via
lua Gauges()
And though this shouldn't contribute to your problem, there is no need to declare your health and maxhealth variables twice.
Hope this helps you out!
Re: Gauges
Posted: Wed Jun 26, 2013 1:40 am
by Jarrin
Thanks a ton for the help Akaya! Everything is working properly now.