Question Inventory.getItems(x).first().getQuantity()

Discussion in 'Developer Support' started by placebo, Jul 26, 2016.

  1. placebo

    Joined:
    Jul 23, 2016
    Messages:
    3
    Likes Received:
    0
    item = Inventory.getItems(x).first();

    itemQuant = item.getQuantity();

    what will be returned in itemQuant?
    Will it return "1" because item is .first or all of the same type ex. "28".

    so itemQuant would be equal to Inventory.getQuantity(x)?
    currently cant execute because i get the " gamepack is being processed " bug.
     
  2. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    445
    Likes Received:
    134
    Inventory.getItems(x).first().getQuantity() should return the quantity number of the item. So if it was a stackable item, it'd return the amount of items within the stack.
     
    placebo and Serene like this.
  3. placebo

    Joined:
    Jul 23, 2016
    Messages:
    3
    Likes Received:
    0
    but Inventory.getQuantity(x) (if unstackable) will return the used slots?
     
  4. proxi

    proxi s̶c̶r̶i̶p̶t̶ bot*

    Joined:
    Aug 23, 2015
    Messages:
    445
    Likes Received:
    134
    I'd just do Inventory.getItems().size() for what you're trying to accomplish there.
     
  5. SlashnHax

    SlashnHax The Chosen One

    Joined:
    Dec 10, 2014
    Messages:
    2,779
    Likes Received:
    731
    No, that will return the total quantity of x.
    This is probably the best solution to finding how many slots are used, and if you want how many slots are used by x you'd want to use Inventory.getItems(x).size()
     

Share This Page

Loading...