[Suggestion] Update to Logical AND/OR

0 favourites
  • 8 posts
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • Would it be possible to update these so you could use them the following way.

    Think that would be very useful, for instant to do this in my game I have to make 112 lines of code, compared to just 16 if this was possible.

    Anyway a small thing but one that I think would make sense if were possible

  • Would it be possible to update these so you could use them the following way.

    Think that would be very useful, for instant to do this in my game I have to make 112 lines of code, compared to just 16 if this was possible.

    Anyway a small thing but one that I think would make sense if were possible

    Logical operator OR, by it's definition, returns only 0 or 1 depnding on the expressions to compare.

    However, I think it could be a really nicz feature to have, a non boolean OR

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Would it be possible to update these so you could use them the following way.

    Think that would be very useful, for instant to do this in my game I have to make 112 lines of code, compared to just 16 if this was possible.

    Anyway a small thing but one that I think would make sense if were possible

    Absolutely. Anything that will streamline the workflow!

    I have similar request for using names of objects, so instead of making 30 condition events for, for example 30 different tiled bg's, I would just make one and pass the name of the tiled bg trough variable.

  • No, we cannot change how the existing operator works, firstly because it's standard in many tools and frameworks that bitwise OR works like that, and secondly it will break a great many existing projects.

    I'm not sure we could even make a new operator that could work like that, and I'm not aware of any language or tool out there that does. I think it is best if you just use an OR block.

  • No, we cannot change how the existing operator works, firstly because it's standard in many tools and frameworks that bitwise OR works like that, and secondly it will break a great many existing projects.

    I'm not sure we could even make a new operator that could work like that, and I'm not aware of any language or tool out there that does. I think it is best if you just use an OR block.

    That's fair enough.

  • If that can help someone understand the why is it like that, the truth table of the AND , OR.

    AND needs all inputs to be at 1 to return 1, otherwise 0

    OR needs all inputs to be at 0 to return 0, otherwise 1

    C2 comparisons operators like = ; < ; > ; <> and so on returns 0 if false and 1 if true

    So you need to try :

    Compare two values :

    ((T = 2)|(T = 1)|(T = 3)|(T = 4))

    =

    1

    if you want some thing to happen if T is 2; 1; 3; or 4

    It is not only an computer thing, a lot of devices are considered to have only to opposite states, and so logical equations exists for them too (however syntax is not the same, the OR is + and the AND is .)

  • One way I handle a situation like that is this:

    find("|1|4|5|6|7|9|11|12|", "|"&var&"|")<>-1[/code:3an99age]
  • [quote:r8x35rxr]One way I handle a situation like that is this:

    Find ("|1|4|5|6|7|9|11|12|", "|"&var&"|")<>-1

    Not really sure how you would use that in a list? Can "find" go through all items in a list?

    [quote:r8x35rxr]I'm not sure we could even make a new operator that could work like that, and I'm not aware of any language or tool out there that does. I think it is best if you just use an OR block.

    Yeah I ended up doing that, but thanks for reply.

    [quote:r8x35rxr]Logical operator OR, by it's definition, returns only 0 or 1 depnding on the expressions to compare.

    Yeah my hope was that it was possible if written in the way I did, that C2 could somehow be made to recognize it in a way so it would just repeat testing the original variable against each value, without having to copy paste it.

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