So, I'm stumped about something gmcp related.

Post Reply
Aydein
Posts: 27
Joined: Wed Sep 13, 2017 8:45 pm

So, I'm stumped about something gmcp related.

Post by Aydein »

At least I think it's GMCP related.

I made myself a set of functions that track players in the room as well as coming and going. It works great.

Now, trying to do the same thing with items is apparently not going to be as easy.

Code: Select all

function updateitems()
	my_items = {}
	for k,v in pairs(gmcp.Char.Items.List) do
    table.insert(my_items, gmcp.Char.Items.List[k].name)
	  itemshere = table.concat(my_items,"\n")
    echo("here:" ..itemshere)
	end
end
I've checked my variables to see if it is doing anything since I didn't pick up any lua errors and it looks like it created the table, but despite being in a room full of items nothing populated. Again, this worked for players but somehow not items?

My registered event is gmcp.Char.Items.List - should I use something else? I added an echo to check if it was registering and it came back with an empty list.

This is what I get off the lua command when I check the items list if it helps..

Code: Select all

{
  items = { {
      icon = "rune",
      id = "61726",
      name = "a runic totem"
    }, {
      attrib = "t",
      icon = "rune",
      id = "199630",
      name = "a monolith sigil"
    } },
  location = "room"
}
Please advise if you have time.

User avatar
demonnic
Posts: 767
Joined: Sat Dec 05, 2009 3:19 pm

Re: So, I'm stumped about something gmcp related.

Post by demonnic »

I think you want something more like
Code: [show] | [select all] lua
function updateitems()
  my_items = {}
  for index,item in ipairs(gmcp.Char.Items.List.items) do
    table.insert(my_items, item.name)
  end
  echo(f[[here: {table.concat(my_items, "\n")}]])
end

Post Reply