Trying to get this working in my mud and having some difficulties, I got past the first few problems and its not giving any errors for now.
When the alias fires it doesn't recognize that the inventory is being displayed, most likely because of how the inventory is listed in this mud.
<aliases>
<alias
name="Inventory_Script"
match="inv"
enabled="y"
group="Inventory"
send_to="12"
sequence="100"
>
<send>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, "FixedSys", 9)
end -- if
-- request inventory
Send "inventory"
-- wait for inventory to start
local x = wait.match ("You are carrying (.*?)", 10)
if not x then
ColourNote ("white", "blue", "No inventory receieved within 10 seconds.")
return
end -- if
local inv = {}
local max_width = WindowTextWidth (win, font, "Inventory")
-- loop until end of inventory
while true do
local line, wildcards, styles = wait.match ("*")
-- see if end of inventory
if string.match (line, "^(.*?) | [Pain: (.*?)") then
break
end -- if
-- save inventory
table.insert (inv, styles)
-- work out max width
max_width = math.max (max_width, WindowTextWidth (win, font, line))
end -- while loop
require "tprint"
tprint (inv)
end)</send>
</alias>
</aliases>
Below is an example of output from my mud.
You are carrying four ruelbone monads, a bowie knife, a pair of green gauntlets, a pair of buckskin pants, a pair of green armwraps, a
silver-trimmed blue cloak, a wooden practice sword, and a canvas pouch.
-E-W-- | [Pain: 0 Fatigue: 0 Unbalance: 0 Fear: 0] | [///] >
The first few lines are my inventory and the last line is my prompt. Any suggestions on getting it to read each item?
|