Whether a variable is equal to EITHER of a list of numbers?

0 favourites
  • 5 posts
From the Asset Store
The game will give you a dog that appeared and you must say if he appeared more, less or equal.
  • Why doesn't this check whether the variable is equal to either of the list of numbers?

    I want it to result true if the variable is equal to any of the numbers in this list. (Preferably without creating a ton of "or" blocks.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try int(tokenAt()), or array's have a condition "contains value".

  • Eh I don't think those will help me too much. The global variable is set at either of those 4 numbers, and if it's either of them, I want this one condition to result true. I can't rewrite the global variable into an array or anything else, I need to be able to compare multiple potential values of the global variable.

    I guess I'll just have to do it the hard way and make a ton of " = 2.5" and "= 4" and "= 8" and "= 12" conditions for each level<number>achievements variable. Pain because there's 45 levels.

  • Compare two values:

    (Levelachidvement = 7)|(Levelachidvement = 8)

    Equal to


    X= y return 0 if false or 1 if true

    A|B|C return 0 if A and B and C are all to 0, returns 1 otherwise

  • Edit: Nevermind below, I changed the code significantly and made it much smaller so it's no big deal.

    I'm really kind of a noob to all these expressions. Here's basically what I want to do, just need to know if there's a more efficient way to do it:

    level<number>achievements gets assigned a number. If it's 2.5 or 4 or 8 or 12, it should set egg1 to 1.

    level<number>achievements gets assigned a number. If it's 7 or 8, it should set silver1 to 1.

    level<number>achievements gets assigned a number. If it's 11 or 12, it should set gold1 to 1.

    Right now I'll be going through and editing each global variable to change it to the next sequential level as I go down the list. I just wanted to minimize the amount of clicking and number changing I have to do.

    I'm just going to open the event sheet in an editor and replace every "level1achievements" with "level2achievements" and so on in each Group. I think that's the fastest and most straightforward way to do it. Tedious, but I've done worse with this game haha. I do things the hard way.

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