My miniwindow is blank with the exception of the word Inventory. The MUD I am applying this to is Achaea and it's inventory setup is different:
Ex)
You are holding:
obsidian dagger, 5 ebony vials, 2 oaken vials, a cherry wood vial, a simple fishing pole, a bait bucket, a snow blossom vial.
You are wearing:
a suit of ring mail, a canvas backpack
I attempted to change some lines as needed, but am uncertain as to what else I need or what is wrong with what I altered. Any input would be appreciated. Thanks!
The current script I have is as follows:
Quote: require "wait"
wait.make (function ()
local win = GetPluginID () .. ":inventory"
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
Send "inventory"
local x = wait.match ("You are holding:", 10)
if not x then
ColourNote ("white", "red", "No inventory was received within 10 seconds.")
return
end
local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")
while true do
local line, wildcards, styles = wait.match ("*")
if not string.match (line, "^You are wearing:") then
break
end
table.insert (inv, styles)
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#inv + 2) + 10
WindowCreate (win, 0, 0, window_width, window_height, 6, 0, ColourNameToRGB "#373737")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
WindowText (win, font, "Inventory", 5, 5, 0, 0, ColourNameToRGB "yellow")
local y = font_height * 2 + 5
for i, styles in ipairs (inv) do
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
end
y = y + font_height
end
WindowShow (win, true)
end) |