Hi. I've attempted to adjust Nick's inventory window (http://www.gammon.com.au/forum/?id=9965) to work with group data so I can permanently monitor group stats. I've had trouble gathering the group info though. Here is the raw data i'd like to capture:
Here is the alias i set up in an attempt to capture it:
I'm sure i have more than one problem. I can't find a good way to end the loop. And it doesn't seem to be capturing the lines I've asked it to.
THanks for any help you can give.
-------------------------------------------------------------------------------
##| Level Name Pos HitPoints ManaPoints MovePoints TNL Align
-------------------------------------------------------------------------------
1|383 Lord September Sleep 54202/54202 1141/1141 18481/18481 499 1000
2|999 Lord Someone Sleep 23635/23635 31040/31040 32480/32960 713 1000
3|999 Lord Alrin Sleep 29012/29012 70599/70599 30760/30760 1247 1000
4| 66 Lord Notea Sleep 5963/5963 24261/34420 6660/6660 554 -1000
5| 26 Lord Eiri Stand 3503/3503 30864/30864 6303/6303 1463 1000
6|132 Lord Urecht Sleep 15731/15731 11499/11499 18711/18711 465 1000
7| 98 Lord Djat Sleep 19521/19521 2867/2867 7057/7057 1335 1000
8|441 Lord Sith Stand 16303/16303 21690/21690 10961/10961 1238 -999
9|999 Lord Mundegaarde Sleep 14186/14186 35494/35494 13340/13340 544 1000
10|202 Lord Meista Sleep 11450/11450 21297/21297 9216/9246 489 1000
11|416 Lord Victim Sleep 13654/13654 26003/26003 6744/6744 1018 -999
Here is the alias i set up in an attempt to capture it:
require "wait"
wait.make (function () -- coroutine starts here
local win = GetPluginID () .. ":group"
local font = "f"
if not WindowInfo (win, 1) then
WindowCreate (win, 0, 0, 0, 0, 6, 0, 0)
WindowFont (win, font, "Lucida Console", 9)
end -- if
-- request group
Send "group"
-- wait for group to start
local x = wait.match ("*|*", 10)
if not x then
ColourNote ("white", "blue", "No group received within 10 seconds")
return
end -- if
local grp = {}
local max_width = WindowTextWidth (win, font, "Group")
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*|*")
-- see if end of inventory
if not string.match (line, "*") then
break
end -- if
-- save group line
table.insert (grp, styles)
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end -- while loop
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#grp + 2) + 10
-- make window correct size
WindowCreate (win, 0, 0, window_width, window_height, 6, 0, ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- heading line
WindowText (win, font, "Group", 5, 5, 0, 0, ColourNameToRGB "yellow")
-- draw each inventory line
local y = font_height * 2 + 5
for i, styles in ipairs (grp) do
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
end -- for
y = y + font_height
end -- for each inventory item
WindowShow (win, true)
end) -- end of coroutine
I'm sure i have more than one problem. I can't find a good way to end the loop. And it doesn't seem to be capturing the lines I've asked it to.
THanks for any help you can give.