Regarding rents - thanks also for those scripts. I've done another alias you may find useful - it's a summary list of items in rents and a lot easier to read (imo). It's based entirely on yours, just with a lot of information removed.
Below is an example
Code: Select all
(rents): Items in rents for Dorien.
Maradon - 1 a crystal lightstick 54g 15c
Maradon - 2 a thin vial of yellow fluid 36g 10c
Maradon - 3 a thin vial of yellow fluid 36g 10c
Maradon - 4 a thin vial of yellow fluid 36g 10c
Maradon - 5 a thin vial of yellow fluid 36g 10c
Maradon - 6 a blackened steel kris 9g 8c
Maradon - 7 a set of steel sai 0c
Maradon - 8 a dull black shield 1g 1c
Twisted Forestlands - 1 a crystal lightstick 54g 15c
Twisted Forestlands - 2 a crystal lightstick 54g 15c
Twisted Forestlands - 3 a blackened steel kris 91g 5c
Twisted Forestlands - 4 a thin vial of yellow fluid 36g 10c
Twisted Forestlands - 5 a thin vial of yellow fluid 36g 10c
Twisted Forestlands - 6 a thin vial of yellow fluid 36g 10c
Twisted Forestlands - 7 a thin vial of yellow fluid 36g 10c
Twisted Forestlands - 8 a thin vial of yellow fluid 36g 10c
Twisted Forestlands - 9 a thin vial of yellow fluid 36g 10c
My command is 'listrentitems' as that matches my general syntax (e.g., start with 'list' for lists). If you don't pass an argument, it provides items for the current character.
Code: Select all
pattern: (^listrentitems$)|(^listrentitems (.+)$)
local name
if matches[3] then
name = matches[4]
else
name = rents.name
end
if name == nil or name == "" then
rents:echo("Character name not set.\n", true)
return
else
rents:echo("<b>Items in rents for "..name..".<reset>\n", false)
end
local rents_db = db:get_database("rents")
local storage = db:fetch(rents_db.storage, db:like(rents_db.storage.name,name))
if table.is_empty(storage) then
rents:echo("No items for the character \""..name.."\" found in the rent database.\n",true)
else
local currentZone = ""
local prevZone = ""
local itemNum
for _, item in pairs(storage) do
currentZone = item.zone
if currentZone ~= prevZone then
itemNum = tonumber(1)
else
itemNum = itemNum + 1
end
local msg = string.format("%-30s <ansi_cyan>%-45s<reset> %s\n",
item.zone.." - "..itemNum,
item.item,
string.gsub(string.gsub(string.gsub(string.gsub(
string.gsub(string.gsub(string.gsub(item.cost,
" gold crowns", "g"),
" gold crown", "g"),
" coppers","c"),
" copper", "c"),
" and", ""),
"no rent due", "0c"),
" rent due", "")
)
cechoLink(msg, function() centerview(item.room) end, "Click to center map on room.", true)
prevZone = currentZone
end
end