[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  InfoBox

InfoBox

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Cyote   (9 posts)  [Biography] bio
Date Wed 27 Aug 2014 07:37 PM (UTC)

Amended on Wed 27 Aug 2014 07:54 PM (UTC) by Nick Gammon

Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 27 Aug 2014 07:52 PM (UTC)
Message
Template:codetag To make your code more readable please use [code] tags as described here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 27 Aug 2014 07:55 PM (UTC)
Message
It's hard to say from your description:


  • What your data is
  • What you expect to see
  • What you actually see

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Cyote   (9 posts)  [Biography] bio
Date Reply #3 on Wed 27 Aug 2014 08:06 PM (UTC)
Message
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?
[Go to top] top

Posted by Cyote   (9 posts)  [Biography] bio
Date Reply #4 on Wed 27 Aug 2014 08:13 PM (UTC)
Message
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 :)
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 28 Aug 2014 04:25 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Cyote   (9 posts)  [Biography] bio
Date Reply #6 on Sun 31 Aug 2014 09:22 AM (UTC)
Message
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.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,601 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]