InfoBox

Posted by Cyote on Wed 27 Aug 2014 07:37 PM — 7 posts, 27,336 views.

#0
I have a problem with InfoBox Columns basically.

Each row will consists of 7 bars and it will move to a new after but it mixes all up.
Below is the Lua Code.
Can someone tell me where I am doing wrong?



function grcall()
  WinWith = 900
  
  GW = {}
  GW = InfoBox:New("Title")
  GW.windowWidth = WinWith
  GW:WindowPosition(GW.windowPositions.NE)
  GW.columns = 7
  
  
  -- Title Part Which is also not working.
  GW:AddBar("Name")
  GW:AddBar("Status")
  GW:AddBar("HP")
  GW:AddBar("Mana")
  GW:AddBar("Move")
  GW:AddBar("TNL")
  GW:AddBar("Align")
  
  Addgroupmates()
  
  
  GW:Update()

end -- function 


function Addgroupmates()
  count = table.getn(GroupList)
  for i = 1, count do 
    GW:AddBar(GroupList[i].Name)
    GW:AddBar(GroupList[i].Status)
    a = GW:AddBar( GroupList[i].CurHp .. "/" .. GroupList[i].MaxHp,
        math.floor(GroupList[i].CurHp / GroupList[i].MaxHp * 100), 
        "green", "firebrick", false,GW.barStyles.gradientFixed + GW.barStyles.glass )
    a.gaugeHeight = a.cellHeight * .3 
    b = GW:AddBar(GroupList[i].CurMana .. "/" .. GroupList[i].MaxMana, 
        math.floor(GroupList[i].CurMana / GroupList[i].MaxMana * 100), "dodgerblue",
        "purple", false, GW.barStyles.gradientFixed + GW.barStyles.glass)
    GW.Bars[4].threshold = 50
    b.gaugeHeight = b.cellHeight * .3 
    
    c = GW:AddBar(GroupList[i].CurMove .. "/" .. GroupList[i].MaxMove, 
        math.floor(GroupList[i].CurMove / GroupList[i].MaxMove * 100), 
        "green", "firebrick", false,GW.barStyles.gradientFixed + GW.barStyles.glass )
    c.gaugeHeight = c.cellHeight * .3 
    
    d = GW:AddBar(GroupList[i].Tnl, 50)
    d.gaugeHeight = d.cellHeight * .3 
    
    e = GW:AddBar(GroupList[i].Align, 50)
    e.gaugeHeight = e.cellHeight * .3 
  end -- if 
end -- function AddGroupmates


[EDIT] Code tags added, code indented.
Amended on Wed 27 Aug 2014 07:54 PM by Nick Gammon
Australia Forum Administrator #1
Template:codetag
To make your code more readable please use [code] tags as described here.
Australia Forum Administrator #2
It's hard to say from your description:

  • What your data is
  • What you expect to see
  • What you actually see
#3
Oki I did some more test about it

Created another Info Box Set Columns to 7 elements

Added 1st element and then start adding elements 1 by 1.

Everything went normal till 7th element. Then after 7
It divided first row into 2 rows moved 3 elements from first
row to second row and then added new one after the 4th one
to the first row

Next element is added below the 5th one on to second row.

I don't think its working properly or am I doing something
wrong still?
#4
What I would like to see is like this

Ex:
Name Status HP Mana Move Tnl Align
Tetra Standing 100/100 100/100 100/100 1000 1000
Penta Standing 100/100 100/100 100/100 1000 1000
Octa Standing 100/100 100/100 100/100 1000 1000


But it gives a complete mix.

Thanks :)
Australia Forum Administrator #5
It looks to me like you are adding the bars each time you call Addgroupmates, so I'm not totally surprised you get more and more bars. You might want to rework so that before adding them you remove existing ones, or just start a new InfoBox from scratch.
#6
Update:

Well I decided to have each groupie stat to have its own infobox but then, depending on the number of groupmates
windows aligned themselves splitting the space equally,
which was something I don't want generally. (I want to see them as a single group without space between them.) Looks
like tho its nice code, infobox doesn't fit my design goals.

So decided to play with miniwindows instead.

Btw Sublime Flow doesn't open my files automatically when
selected as Script Editor, anyone knows how to fix it?

Thanks.