How do I use mathematical "or" | operator?

Get help using Construct 2

Post » Sat Feb 27, 2016 11:55 pm

I red the manual. The "|" should act as "or" statement, but for some reason I can not get this to work.

Example CapX: https://drive.google.com/open?id=0B5xC9 ... 0VqMncwclU

I know you can add "or" statements to whole block, but this is not suitable for me because I need to check multiple chunks of conditions. If one of the chunks is true (all conditions met in that chunk of conditions) then do the action.

Help appreciated, am I doing something wrong or is it a bug?
B
6
S
2
Posts: 24
Reputation: 531

Post » Sun Feb 28, 2016 12:04 am

Add both (or more) if you're doing multiple and then right click on the far left of the conditions and select "Make 'or' block"
B
12
S
2
G
1
Posts: 42
Reputation: 879

Post » Sun Feb 28, 2016 12:06 am

russellit wrote:Add both (or more) if you're doing multiple and then right click on the far left of the conditions and select "Make 'or' block"


As I stated in my post this is not the case I am looking for, it simply won't work for what I am trying to do. The capx file is just a simple example of how | operator is used (just like in the manual), not the project itself.

How do I do this?

Image
Last edited by Radiowaves on Sun Feb 28, 2016 12:16 am, edited 2 times in total.
B
6
S
2
Posts: 24
Reputation: 531

Post » Sun Feb 28, 2016 12:10 am

Sorry, should have read the whole thing. I'll download it and take a look
B
12
S
2
G
1
Posts: 42
Reputation: 879

Post » Sun Feb 28, 2016 12:17 am

You 'should' be able to achieve the same result using an else-if and then putting the code into a function to save duplication.
B
12
S
2
G
1
Posts: 42
Reputation: 879

Post » Sun Feb 28, 2016 12:27 am

Yeah I could add another "else" statement or mess around with nesting, its getting rather complicated this way. Why does the | not work? What am I missing?
B
6
S
2
Posts: 24
Reputation: 531

Post » Sun Feb 28, 2016 1:02 am

Image
Image
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Sun Feb 28, 2016 1:11 am

Ok as I understand it the "|" operator is basically an if-else statement that returns 0 or 1. It does not work with just pure numbers, it only works with conditions? How I implement this to check an array value I have no idea.

Did it your way, can't use array because there is no way of checking the array value in expression like you could do it with tilemap. So I used tilemap and came up with this:

Image

This is quite insane in my opinion, all because "or" could not be defined correctly.

I would like to do the floor calculation beforehand and keep it in an array to save computation time since there is a lot to check like this.
B
6
S
2
Posts: 24
Reputation: 531

Post » Sun Feb 28, 2016 3:50 am

Radiowaves wrote: How I implement this to check an array value I have no idea..


Image
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Sun Feb 28, 2016 1:28 pm

*sigh* I overlooked the "At" function. Thank you!
B
6
S
2
Posts: 24
Reputation: 531


Return to How do I....?

Who is online

Users browsing this forum: FlyingRam and 9 guests