Alternative "or" for checking multiple variables [solved]

For questions about using Classic.

Post » Sat Mar 19, 2011 3:26 pm

So, the "or" condition is being buggy for me, so I have been looking for an alternative method of checking several different private variables. Unfortunately "or" is hard to search on, so I apologize if this has already been answered before ^^;

What I want to do, is that when the player clicks a button, the game will run a check on 5 or so objects' private variable to see if any of them returns "0". If just one of them has 0, I want one thing to happen. If none of them do, I want something else to happen.

I tried to improvise with something like this (only two objects in test):

System compare: str(Elli('activity')) or str(Sheila('activity')) Different to 0

But it's not really working...

Any ideas?
B
10
S
3
G
3
Posts: 110
Reputation: 2,206

Post » Sat Mar 19, 2011 4:17 pm

If you have multiple instances you can pick the instances you want to check via private variable, and then once they are picked you can check those selected objects using "For each".
You can then use yet another variable(global) to add to the "zero" count if one equals 0, then if the count is greater than 0 do this, equal to 0 do that.

If you want a particular object picked in the comparison you should use "Compare a private variable". System compare will not pick for you.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Mar 19, 2011 4:37 pm

I was a little confused by your reply at first, but while testing it I actually found out how to make it work by using another global variable.

So thanks! :)
B
10
S
3
G
3
Posts: 110
Reputation: 2,206


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests