When a pick don't pick anything...

Discussion and feedback on Construct 2

Post » Wed Oct 09, 2013 12:59 am

(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?klkitchens2013-10-09 01:00:29
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Wed Oct 09, 2013 2:51 am

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)

B
10
S
4
G
1
Posts: 58
Reputation: 1,420

Post » Sat Nov 23, 2013 12:09 am

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!
B
9
S
1
Posts: 18
Reputation: 526


Return to Construct 2 General

Who is online

Users browsing this forum: A2D, paxto22, Refeuh and 1 guest