This set of aliases will sort your items in a separate window. It works for containers, inventory and bank box.
The commands are as follows
inv - inventory window
l in <container> - container window
bank - safety deposit box window
noinv - removes window from your screen
**99% of this was made by Nick Gannon, creator of MUSHClient.**
Highlight and copy (ctrl c) everything in one of the code boxes below,
In MUSH, open your Aliases window (ctrl shift 9)
Click paste.
Repeat this process for each of the aliases below.
EDIT: See post below for updated version.
MUSH: items sorted and sent to miniwindow
MUSH: items sorted and sent to miniwindow
Last edited by Visyn on Sat Sep 27, 2014 1:25 am, edited 2 times in total.
Re: MUSH: items sorted and sent to miniwindow
Here's what it looks like:
Inventory:

Container:

Safety Deposit Box:

EDIT: Blocked out some of my bank inventory.
Inventory:

Container:

Safety Deposit Box:

EDIT: Blocked out some of my bank inventory.
Re: MUSH: items sorted and sent to miniwindow
This version will display in your output window. Copy everything in the box below and paste into your aliases.
Code: Select all
<aliases>
<alias
match="bank"
enabled="y"
group="inventory"
send_to="12"
sequence="100"
>
<send>
require "wait"
wait.make (function () -- coroutine starts here
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", 6)
end -- if
-- request inventory
Send "list"
-- wait for inventory to start
local x = wait.match ("===========================", 10, trigger_flag.OmitFromOutput)
if not x then
ColourNote ("white", "blue", "No inventory received within 10 seconds")
return
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, " ")
default_category = "Other"
inventory_type = {
Containers = { "pack", "bag", "sack", "backpack", "box", "chest ", "case", "satchel", },
Weapons = { "scepter", "sword", "dirk", "dagger", "bow", },
Ammo = { "arrows", "bullets", "darts", },
Jewelry = { "necklace", "bangle", "bracelet", "ring", },
Resources = { "bundle", "salt", "some pine (", "some balsa (", "some cypress (", "some cherrywood (", },
Armor = { "cuirass", "chestplate", "armor", },
Clothing = { "shirt", "trousers", "pants", },
[default_category] = { }, -- default
} -- end of inventory_type
category_count = 0
for name in pairs (inventory_type) do
category_count = category_count + 1
end -- for
-- for duplicates
existing_items = { }
max_quantity = 1
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)
-- see if end of inventory
if not string.match (line, "^ ?an?") then
if not string.match (line, "^ ?some") then
if not string.match (line, "^$") then
break
end -- if
end -- if
end -- if
if styles [1] then
line = Trim (line)
styles.line = line
styles [1].text = string.gsub (styles [1].text, "^ ", "")
for category, keywords in pairs (inventory_type) do
if styles.category then
break
end -- if
for _, item in ipairs (keywords) do
if string.find (line, item, 1, true) then
styles.category = category
break
end -- if found
end -- for each item
end -- for each category
if not styles.category then
styles.category = default_category
end -- if
-- look for a duplicate
item_number = existing_items [line]
-- if found, increase its quantity
if item_number then
inv [item_number].quantity = inv [item_number].quantity + 1
max_quantity = math.max (max_quantity, inv [item_number].quantity)
else
styles.quantity = 1 -- start with one of them
existing_items [line] = #inv + 1 -- remember its new position
-- save inventory line
inv [#inv + 1] = styles
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end -- if
end -- if at least one style
end -- while loop
max_quantity_digits = math.floor (math.log10 (max_quantity)) + 1
if max_quantity > 1 then
max_width = max_width + WindowTextWidth (win, font, string.format (" x%s", string.rep ("9", max_quantity_digits)))
end -- if
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#inv + (category_count * 2) + 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, "Safety Deposit Box", 5, 5, 0, 0, ColourNameToRGB "yellow")
ColourNote ("yellow", "black", "===========================")
-- draw each inventory line
local y = font_height * 2 + 5
-- sort them
function my_sort_function (a, b)
-- category less than?
if a.category < b.category then return true end
-- category greater than?
if a.category > b.category then return false end
-- name less than?
if a.line < b.line then return true end
-- name greater than?
if a.line > b.line then return false end
-- names the same, compare weights ...
-- weight less than
-- not less than
return false
end -- function
table.sort (inv, my_sort_function)
old_category = nil
for i, styles in ipairs (inv) do
if styles.category ~= old_category then
y = y + font_height
WindowText (win, font, styles.category, 5, y, 0, 0, ColourNameToRGB "lightgray")
ColourNote ("", "", "")
ColourNote ("green", "", (styles.category))
old_category = styles.category
y = y + font_height
end -- if new category
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
style.text = Trim (style.text)
ColourTell (style.textcolour, style.backcolour, " " .. style.text)
end -- for
if styles.quantity > 1 then
WindowText (win, font, string.format (" x%i", styles.quantity), x, y, 0, 0, ColourNameToRGB "lightgreen")
ColourTell ("lightgreen", "", (string.format (" x%i", styles.quantity)))
end -- if
print "" -- finish off line
y = y + font_height
end -- for each inventory item
WindowShow (win, true)
Note ("")
end) -- end of coroutine</send>
</alias>
<alias
match="inv"
enabled="y"
group="inventory"
send_to="12"
sequence="100"
>
<send>
require "wait"
wait.make (function () -- coroutine starts here
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", 6)
end -- if
-- request inventory
Send "inventory"
-- wait for inventory to start
local x = wait.match ("Inventory:", 10, trigger_flag.OmitFromOutput)
if not x then
ColourNote ("white", "blue", "No inventory received within 10 seconds")
return
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")
default_category = "Other"
inventory_type = {
Containers = { "pack", "bag", "sack", "backpack", "box", "chest ", "case", "satchel", },
Weapons = { "scepter", "sword", "dirk", "dagger", "bow", },
Ammo = { "arrows", "bullets", "darts", },
Jewelry = { "necklace", "bangle", "bracelet", "ring", },
Resources = { "bundle", "salt", "some pine (", "some balsa (", "some cypress (", "some cherrywood (", },
Armor = { "cuirass", "chestplate", "armor", },
Clothing = { "shirt", "trousers", "pants", },
[default_category] = { }, -- default
} -- end of inventory_type
category_count = 0
for name in pairs (inventory_type) do
category_count = category_count + 1
end -- for
-- for duplicates
existing_items = { }
max_quantity = 1
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)
-- see if end of inventory
if not string.match (line, "^ ?an?") then
if not string.match (line, "^ ?some") then
if not string.match (line, "^$") then
break
end -- if
end -- if
end -- if
if styles [1] then
line = Trim (line)
styles.line = line
styles.weight = tonumber (string.match (line, "%%(([0-9.]+) lbs?%%)"))
styles [1].text = string.gsub (styles [1].text, "^ ", "")
for category, keywords in pairs (inventory_type) do
if styles.category then
break
end -- if
for _, item in ipairs (keywords) do
if string.find (line, item, 1, true) then
styles.category = category
break
end -- if found
end -- for each item
end -- for each category
if not styles.category then
styles.category = default_category
end -- if
-- look for a duplicate
item_number = existing_items [line]
-- if found, increase its quantity
if item_number then
inv [item_number].quantity = inv [item_number].quantity + 1
max_quantity = math.max (max_quantity, inv [item_number].quantity)
else
styles.quantity = 1 -- start with one of them
existing_items [line] = #inv + 1 -- remember its new position
-- save inventory line
inv [#inv + 1] = styles
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end -- if
end -- if at least one style
end -- while loop
max_quantity_digits = math.floor (math.log10 (max_quantity)) + 1
if max_quantity > 1 then
max_width = max_width + WindowTextWidth (win, font, string.format (" x%s", string.rep ("9", max_quantity_digits)))
end -- if
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#inv + (category_count * 2) + 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, "Inventory", 5, 5, 0, 0, ColourNameToRGB "yellow")
ColourNote ("", "", "")
ColourNote ("yellow", "black", "Inventory:")
-- draw each inventory line
local y = font_height * 2 + 5
-- sort them
function my_sort_function (a, b)
-- category less than?
if a.category < b.category then return true end
-- category greater than?
if a.category > b.category then return false end
-- name less than?
if a.line < b.line then return true end
-- name greater than?
if a.line > b.line then return false end
-- names the same, compare weights ...
-- weight less than
if a.weight and b.weight then
if a.weight < b.weight then return true end
end -- if
-- not less than
return false
end -- function
table.sort (inv, my_sort_function)
old_category = nil
for i, styles in ipairs (inv) do
if styles.category ~= old_category then
y = y + font_height
WindowText (win, font, styles.category, 5, y, 0, 0, ColourNameToRGB "lightgray")
ColourNote ("", "", "")
ColourNote ("green", "", (styles.category))
old_category = styles.category
y = y + font_height
end -- if new category
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
ColourTell (style.textcolour, style.backcolour, " " .. style.text)
end -- for
if styles.quantity > 1 then
WindowText (win, font, string.format (" x%i", styles.quantity), x, y, 0, 0, ColourNameToRGB "lightgreen")
ColourTell ("lightgreen", "", (string.format (" x%i", styles.quantity)))
end -- if
print "" -- finish off line
y = y + font_height
end -- for each inventory item
ColourNote ("", "", "")
WindowShow (win, true)
end) -- end of coroutine
</send>
</alias>
<alias
match="l in *"
enabled="y"
group="inventory"
send_to="12"
sequence="100"
>
<send>
require "wait"
wait.make (function () -- coroutine starts here
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", 6)
end -- if
-- request inventory
Send "look %1"
-- wait for inventory to start
local x = wait.match ("Inside you see:", 10, trigger_flag.OmitFromOutput)
if not x then
ColourNote ("white", "blue", "No inventory received within 10 seconds")
return
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, "Container")
default_category = "Other"
inventory_type = {
Containers = { "pack", "bag", "sack", "backpack", "box", "chest ", "case", "satchel", },
Weapons = { "scepter", "sword", "dirk", "dagger", "bow", },
Ammo = { "arrows", "bullets", "darts", },
Jewelry = { "necklace", "bangle", "bracelet", "ring", },
Resources = { "bundle", "salt", "some pine (", "some balsa (", "some cypress (", "some cherrywood (", },
Armor = { "cuirass", "chestplate", "armor", },
Clothing = { "shirt", "trousers", "pants", },
[default_category] = { }, -- default
} -- end of inventory_type
category_count = 0
for name in pairs (inventory_type) do
category_count = category_count + 1
end -- for
-- for duplicates
existing_items = { }
max_quantity = 1
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*", 0, trigger_flag.OmitFromOutput)
-- see if end of inventory
if not string.match (line, "^ ?an?") then
if not string.match (line, "^ ?some") then
if not string.match (line, "^$") then
break
end -- if
end -- if
end -- if
if styles [1] then
line = Trim (line)
styles.line = line
styles.weight = tonumber (string.match (line, "%%(([0-9.]+) lbs?%%)"))
styles [1].text = string.gsub (styles [1].text, "^ ", "")
for category, keywords in pairs (inventory_type) do
if styles.category then
break
end -- if
for _, item in ipairs (keywords) do
if string.find (line, item, 1, true) then
styles.category = category
break
end -- if found
end -- for each item
end -- for each category
if not styles.category then
styles.category = default_category
end -- if
-- look for a duplicate
item_number = existing_items [line]
-- if found, increase its quantity
if item_number then
inv [item_number].quantity = inv [item_number].quantity + 1
max_quantity = math.max (max_quantity, inv [item_number].quantity)
else
styles.quantity = 1 -- start with one of them
existing_items [line] = #inv + 1 -- remember its new position
-- save inventory line
inv [#inv + 1] = styles
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end -- if
end -- if at least one style
end -- while loop
max_quantity_digits = math.floor (math.log10 (max_quantity)) + 1
if max_quantity > 1 then
max_width = max_width + WindowTextWidth (win, font, string.format (" x%s", string.rep ("9", max_quantity_digits)))
end -- if
local font_height = WindowFontInfo (win, font, 1)
local window_width = max_width + 10
local window_height = font_height * (#inv + (category_count * 2) + 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, "Container", 5, 5, 0, 0, ColourNameToRGB "yellow")
ColourNote ("yellow", "black", "Inside you see:")
-- draw each inventory line
local y = font_height * 2 + 5
-- sort them
function my_sort_function (a, b)
-- category less than?
if a.category < b.category then return true end
-- category greater than?
if a.category > b.category then return false end
-- name less than?
if a.line < b.line then return true end
-- name greater than?
if a.line > b.line then return false end
-- names the same, compare weights ...
-- weight less than
if a.weight and b.weight then
if a.weight < b.weight then return true end
end -- if
-- not less than
return false
end -- function
table.sort (inv, my_sort_function)
old_category = nil
for i, styles in ipairs (inv) do
if styles.category ~= old_category then
y = y + font_height
WindowText (win, font, styles.category, 5, y, 0, 0, ColourNameToRGB "lightgray")
ColourNote ("", "", "")
ColourNote ("green", "", (styles.category))
old_category = styles.category
y = y + font_height
end -- if new category
local x = 5
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
ColourTell (style.textcolour, style.backcolour, " " .. style.text)
end -- for
if styles.quantity > 1 then
WindowText (win, font, string.format (" x%i", styles.quantity), x, y, 0, 0, ColourNameToRGB "lightgreen")
ColourTell ("lightgreen", "", (string.format (" x%i", styles.quantity)))
end -- if
print "" -- finish off line
y = y + font_height
end -- for each inventory item
WindowShow (win, true)
Note ("")
end) -- end of coroutine
</send>
</alias>
<alias
match="noinv"
enabled="y"
group="inventory"
send_to="12"
sequence="100"
>
<send>
local win = GetPluginID () .. ":inventory"
WindowShow (win, false)
</send>
</alias>
</aliases>
- Kody_Oakborne
- Citizen of Archai
- Posts: 209
- Joined: Tue Apr 22, 2014 1:35 am
Re: MUSH: items sorted and sent to miniwindow
SWEET! Thanks!
What I would suggest to folks is to copy all of this to a notepad and save it as Inventory.MCA then just "Load" it from the alias panel, which can be accessed by pressing the little a with an arrow button or pressing Shift + Ctrl + 9
What I would suggest to folks is to copy all of this to a notepad and save it as Inventory.MCA then just "Load" it from the alias panel, which can be accessed by pressing the little a with an arrow button or pressing Shift + Ctrl + 9
May the trees guard you, and house you, and guide you.
Kody
Kody