ID:2564659
 
(See the best response by Nadrew.)

So recently i made an item shop. My problem is getting the players inventory list to display inside the Inventory tab

What are you using to display the inventory (interface grids, statpanels, ec.) and how have you set up your items?

For example the below will pick up all obj/items in the players contents, but it will also loop through all obj/item in their contents. So if you have any additional conditions or a lot of items that you want excluding it may be worth adding a list of items you want to be in their inventory and looping through that instead of their contents.

If you're using statpanels it's worth noting the if statement on the statpanel which should stop it updating when the stat isn't active.
mob
Stat()
if(statpanel("Items"))
for(var/obj/items/A in contents) stat(A)
I am using Statpanel, and player's iventory is a list.
In response to Legacy of Caine
Best response
Legacy of Caine wrote:

> mob
> Stat()
> if(statpanel("Items"))
> for(var/obj/items/A in contents) stat(A)
>


You don't need a loop here.

stat(contents)


Will accomplish what you're going for, you only need to manually loop over the list if you need to filter things out of it. In that case you're probably better off storing things in separate lists.

hmmm, kinda lost
Sharky12 wrote:
My problem is getting the players inventory list to display inside the Inventory tab


mob
Stat()
if(statpanel("Inventory"))
stat(contents)


The above snippet will let you display the players inventory inside an inventory tab.

If you can provide an example of where you are so far it will give us a better idea of what you're trying to achieve and where we can help. (:
statpanel("Inventory",contents,Inventory)


I used this, it works but i feel like there is a more efficient way