Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-03-28 17:31:58



Reply to topic  [ 2 posts ] 
Count of worn attachments in inventory floaters Worn tab? 
Author Message

Joined: 2011-10-07 10:39:20
Posts: 181
Reply with quote
Hi,

for various reasons i tend to hit the max attachment limits quite frequently.
It would be nice if the worn tab in the inventory panel could show the number of worn attachments counting against the limit, to see how many are left.
Can obviously done by manual counting too, but well, being lazy...

If you could give me a hint where to look in the code i could probably come up with a patch myself.

Thx,
Kathrine


2020-11-16 22:02:18
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
For all such specific purposes, I implemented Lua scripting... :P

Code:
function GetOutfitStats()
   local k, v

   -- Count the number of attachments currently worn
   local attach_count = 0
   local attached = GetAgentAttachments()
   for k, v in pairs(attached) do
      attach_count = attach_count + 1
   end

   -- Count the number of wearable items, detailing the number of layers for each item type
   local wearable_count = 0
   local wearables = {}
   local worn = GetAgentWearables()
   for k, v in pairs(worn) do
      wearable_count = wearable_count + 1
      local i = string.find(v, "|")
      local w = string.sub(v, i + 1)
      if wearables[w] then
         wearables[w] = wearables[w] + 1
      else
         wearables[w] = 1
      end
   end
   local report = "Wearing " .. attach_count .. " attachments ("
   report = report .. GetAgentInfo()["attachment_limit"] - attach_count .. " slot(s) left) and "
   report = report .. wearable_count .. " wearable items"
   for k, v in pairs(wearables) do
      report = report .. " - " .. v .. " x " .. k
   end
   return report
end

print(GetOutfitStats())


You may simply add the GetOutfitStats() function to your automation.lua script and bind it to either a Lua pie menu slice, a Lua side-bar button, or use it in an OnSendChat() callback, associating it for example to an "/os" (for outfit stats) pseudo-gesture. And of course, instead of printing the report in the chat console, you may use a Lua notification... Example:
Code:
function OnSendChat(text)
   if text == "/os" then
      OpenNotification(1, GetOutfitStats())
      return ""
   end
   return text
end


EDIT (2020-11-21): added today's viewer release attachments limit support (via GetAgentInfo()) in GetOutfitStats().


2020-11-17 16:07:57
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.