# Safe cracking with multiple variables?

Get help using Construct 2

### » Mon Feb 03, 2014 10:23 am

Title says it all, I want to check the status of 3 different inputs, they all have to be true to continue.

Tried to use an array with 3 boolean and toggle each variable when the right number has been set, change it to false when a different number is set. Now how do I go through the array to check if all 3 boolean are true? I can only see sorting and writing options.

Do I need a fourth boolean that is set to false if any of the other 3 is false?

Tried to just compare the variables but I can only compare 2. So far I had to write 3 functions to set the values for all 3 variables, havent figured out so far how to do this much easier and the examples I found in the forum are outdated or not available anymore.

Thx in advance for help.
B
3
Posts: 4
Reputation: 208

### » Mon Feb 03, 2014 10:29 am

I guess a simple or block would do the trick:

Variable 1 is not true
or
variable 2 is not true
or
variable 3 is not true
- safe stays locked

else
- open safe
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Mon Feb 03, 2014 11:00 am

What I am missing is that I can create an array with boolean elements and then I cant compare them or read them. Is the value TRUE equal to 1? I created 3 boolean instance variables in that array and I dont understand how I access them.
And I think I need AND blocks not OR ones or I just dont see that else function yet.
B
3
Posts: 4
Reputation: 208

### » Mon Feb 03, 2014 11:07 am

I made an or block to check if one of the values is still not true.
If one of the values is not true, the safe won't open, right?

When all the values are true (the else statement) the safe will open.

If you want to know if a value at a specific spot in an array is 1, you can use:

Array compare at x,y = 1
LittleStain2014-02-03 11:08:50
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Mon Feb 03, 2014 11:50 am

Gosh this forum is a pain when you use Opera, either I dont have the rights for a quick reply, or the session got lost or even I get logged out once I focus on construct for 10 minutes.

The point is that ELSE is red and has a "(not valid here)" when I put it close to the OR blocks, which makes sense. But how can I put it into a position that it is connected to this? Just to check this I made 3 buttons and the background turns green when all of them have been clicked (OR) but red (ELSE) when not each one has been clicked. Guess what, the background stays green all the time.
B
3
Posts: 4
Reputation: 208

### » Mon Feb 03, 2014 12:05 pm

I created a Capx to show you what I mean:

Here's the capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### » Mon Feb 03, 2014 12:21 pm

Now this is really getting funny, I got the version from steam and it is built 158.2 as well when I try to download the free version it shows me a 158.2 version.
Your version is 159, which makes it impossible for me to view it.

I really appreciate your help, thank you, but I could do this more easily programming in java or alike, this software, this forum and this way to release software makes nothing easier for me.

The session expired just after writing 6 lines before I could post this, unbelievable ..
B
3
Posts: 4
Reputation: 208

### » Mon Feb 03, 2014 1:39 pm

Agreed, the forum with it's time-out is terribly irritating.

I always use the latest beta, I think you can get beta-versions through steam too.

Here's an image of the event sheet.
I created three sprites with two frames (red and green)
I created a green tiledbackground and set it to invisible.

I think these events are pretty easy.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

### Who is online

Users browsing this forum: LunaticCat and 41 guests