Results 1 to 4 of 4

Thread: Determine if Infinite Bag contains item

  1. #1
    Join Date
    May 2016
    Posts
    1,072

    Determine if Infinite Bag contains item

    I was wondering if anybody had any tricks for determining if an infinite bag has an item in it to spawn or not?

    As-is, I have a button that spawns things from an infinite bag. But it will obviously throw an error if the bag is "empty". getQuantity returns 99 for infinite bags regardless if they have something assigned in them or not.

    If nobody has any tricks, then I guess this is one for the suggestion pile haha

  2. #2
    Join Date
    May 2016
    Posts
    1,072
    I guess if you get a change Lucky, could you move this to scripting suggestions?

    New member variable request: object.has_contents

    Returns true if a container holds objects (or if an infinite bag has an item assigned to it) and false if it does not. And return nil if it is not a container.

    Alternative 1: We don't really need it for normal containers (getObjects and if #objectTable ~= 0), so if it would be easier, just object.infinite returning true/false if a given object has infinite contents.

    Alternative 2: Having getQuantity return something specific. Right now it returns 99 for a "filled" infinite bag or an empty one. Having it return 98 if it isn't filled would also solve this.
    Last edited by MrStump; 03-06-2017 at 11:32 PM.

  3. #3
    I guess if you get a change Lucky, could you move this to scripting suggestions?
    Done

  4. #4
    Join Date
    May 2016
    Posts
    1,072
    I circled back and bumped into this problem again. Not major, but I had a thought.

    If we could use getObjects() on infinite bags, returning an empty table if the infinite bag is empty or a table with 1 entry (or 99 entries) with the contained objects information (name, etc), that would cover it.

Similar Threads

  1. Replies: 2
    Last Post: 01-20-2017, 07:48 PM
  2. Card Box Custom item
    By Fredgerd in forum General Discussion
    Replies: 2
    Last Post: 01-16-2017, 06:11 PM
  3. Replies: 7
    Last Post: 06-08-2016, 01:51 PM
  4. Single Click Item Movement
    By Shifty in forum Suggestions
    Replies: 1
    Last Post: 12-23-2015, 10:51 AM
  5. Rulebook as an item
    By Freddo3000 in forum General Discussion
    Replies: 8
    Last Post: 04-10-2015, 12:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •