When a pick don't pick anything...

0 favourites
  • 3 posts
From the Asset Store
UID TO ANYTHING
$18 USD
20% off
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • (intentional slang, I'm a USA southern boy)...

    Anyway... I'm calling a function that is working just fine... until there are no items left to pick.

    Essentially I have a "IsFilled" instance variable and when I put an object into it, I set IsFilled to true and when I remove it the object, I set it to false. That works fine.

    Everytime I add or remove an item, I make a call to see if all the slots are full. If they are, I want to turn on a button for the user to press. So that function UpdateButton is working just fine.

    I call:

    GameFunctions On "Library_UpdateButton"

    System Pick All Basket

    Basket X Is IsFilled

    To get all the baskets that are not filled...

    then subevents

    System. Basket.PickedCount = 0 (Show button)

    System. Basket.PickedCount NE 0 (Hide Button) (NE = not equal)

    Works great SO LONG AS IT CAN PICK ONE ITEM.

    Once there are no baskets remaining to be filled, the system bypasses the subevents.

    How can I check to see if there are NO items that meet the condition?

    I could maintain a counter (kludgy).

    I could, I suppose check for IsFilled = true and compare .PickedCount to .Count and then do an else condition? But would that still get called on none picked?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Try to start with big selection groups, and use your sub-events to further divide.

    GameFunctions On "Library_UpdateButton"

    a. If you want anything to act all the time do it here, followed by sub-events

    1. Basket X IsFilled

    1.a. Do stuff here when there are baskets not filled like before: (Hide button)

    2. ELSE

    2.a. This will only get executed if 1. didn't happen, meaning all the baskets are filled: (Show button)

  • OP, you are a genius sent from the heavens. Thank you for posting, it solved a problem I had displaying inventory (I have a bunch of inventory slots, I needed the system to pick the first empty one).

    GENIUS.

    Thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)