Better late than never, right?
First, a small bug fix was made to InfoBox.lua.
Line 490: z= tonumber(z) or z
I'll send the updated file to Nick to make his life easier.
Since InfoBox draws Bars vertically down column 1, then Column 2, etc... You'll need to get a little creative in how you add more Bars. There's an InsertBar function that handles the reordering for you, if you can figure out what index you want to put them in...
InfoBox will just watch the GroupList table, which I figure will be kept updated by your triggers. There's litle need to mess with the Addgroupmembers function once you set the styles how you want. You can mess with the UpdateLabels() function to do other Happy stuff as you get more familiar and ambitious.
require "InfoBox"
HPFormat = "@k HP: %i/%i"
ManaFormat = "@kMana: %i/%i"
MoveFormat = "@kMove: %i/%i"
function grcall()
WinWith = 900
GW = {}
GW = InfoBox:New("Title")
GW.windowWidth = WinWith
GW:WindowPosition(GW.windowPositions.NE)
GW.columns = 7
GW.axis = "rows"
GW:AddBar("Name")
GW:AddBar("Status")
GW:AddBar("HP")
GW:AddBar("Mana")
GW:AddBar("Move")
GW:AddBar("TNL")
GW:AddBar("Align")
Addgroupmates()
UpdateLabels()
end -- function
function Addgroupmates()
for k,Member in ipairs(GroupList) do
GW:InsertBar(k + 1 , Member.Name, 0, 0, 0, false, 0)
GW:InsertBar(2*k+2, Member.Status, 0, 0, 0, false, 0)
a = GW:InsertBar(3*k+3, "", Member.perHP, "green", "firebrick", false, GW.barStyles.gradientFixed + GW.barStyles.glass )
a.gaugeHeight = a.cellHeight * .3
a:WatchCaption ( "GroupList["..k.."].formattedCap")
a:WatchValue ("GroupList[" .. k .. "].perHP")
b = GW:InsertBar(4*k+4,"", 0 , "dodgerblue", "purple", false, GW.barStyles.gradientFixed + GW.barStyles.glass)
b:WatchCaption ("GroupList["..k.."].formattedMana")
b:WatchValue ("GroupList["..k.."].perMana")
b.threshold = 50
b.gaugeHeight = b.cellHeight * .3
c = GW:InsertBar(5*k+5,"", Member.perMove, "green", "firebrick", false, GW.barStyles.gradientFixed + GW.barStyles.glass )
c:WatchCaption ("GroupList["..k.."].formattedMove")
c:WatchValue ("GroupList["..k.."].perMove")
c.gaugeHeight = c.cellHeight * .3
d = GW:InsertBar(6*k+6,Member.Tnl, 0)
d.WatchCaption = ("GroupList["..k.."].Tnl")
d.gaugeHeight = d.cellHeight * .3
e = GW:AddBar(Member.Align, 0)
e.WatchCaption = "GroupList["..k.."].Align"
e.gaugeHeight = e.cellHeight * .3
end -- if
end -- function AddGroupmates
function UpdateLabels( )
for k,Member in pairs (GroupList) do
Member.formattedCap = ( HPFormat:format(Member.CurHp, Member.MaxHp) )
Member.formattedMana = ( ManaFormat:format(Member.CurMana, Member.MaxMana) )
Member.formattedMove = ( MoveFormat:format(Member.CurMove, Member.MaxMove) )
Member.perHP = Member.CurHp / Member.MaxHp*100
Member.perMana = Member.CurMana / Member.MaxMana*100
Member.perMove= Member.CurMove / Member.MaxMove*100
end
GW:Update()
end
--Sample Data
GroupList = {
{Name = "George", Status = "StandingG", CurHp = 100, MaxHp = 100, CurMove = 100, MaxMove = 100, CurMana = 10, MaxMana = 100, Tnl = 1000, Align = 1000, perHP = 0, perMana = 0, perMove=0, capHP="", capMana="", capMove="", } ,
{Name = "Jane", Status = "StandingJ", CurHp = 90, MaxHp = 100, CurMove = 90, MaxMove = 100, CurMana = 20, MaxMana = 100, Tnl = 997, Align = 777, perHP = 0, perMana = 0, perMove=0, capHP="", capMana="", capMove="", } ,
{Name = "Simba", Status = "StandingS", CurHp = 80, MaxHp = 100, CurMove = 80, MaxMove = 100, CurMana = 30, MaxMana = 100, Tnl = 887, Align = 666, perHP = 0, perMana = 0, perMove=0, capHP="", capMana="", capMove="", } ,
{Name = "Banana", Status = "StandingB", CurHp = 70, MaxHp = 100, CurMove = 70, MaxMove = 100, CurMana = 40, MaxMana = 100, Tnl = 777, Align = 555, perHP = 0, perMana = 0, perMove=0, capHP="", capMana="", capMove="", } ,
}
Okay, back to casual lurking for another 3 years... |