How do I check a ton of variables in a specific order?

  • When I start a specific layout, I want to check if a global variable is set to "alert", which will determine if a notification is shown or not.

    The problem is, there's a lot of these variables, 100 of them.

    I know a really long way to check all of them, but I'm wondering if anyone knows a smarter, quicker way to do it? My long and winded way: imgur.com/AIRTsYT

    Just multiply that picture by 100 and that'll be my future if there's not a quicker way to do it

    (Sorry for all the edits, I can't figure out this new forum just yet)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use an array instead of variables. Then you can do your check with one event

    start of layout

    array: for each x

    array.currentValue = "alert"

    --- aquire_tile: set animation frame to array.curX

  • Yeah, you really should use an array or a dictionary.

    If you absolutely need to do this with variables, here is a compact way to check them all:

    local text variable s
    Set s to (str(Title1="alert") & str(Title2="alert") & str(Title3="alert")...
    
    Compare two values find(s, "1")= -1 -> Acquire_Tile set invisible
    Else -> Acquire_Tile set animation frame to find(s, "1")
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)