[Ace] Checking multiple values from one in a variable.

Discussion in 'RGSSx Script Support' started by CrawlinUK, Jun 22, 2014.

    Tags:
  1. CrawlinUK

    CrawlinUK Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Hi

    I am trying to check for the values 2, 3 or 4 in Variable3.

    I am using a conditional branch for Variable3 and was attempting to use the script.

    I tried:

    $game_variables[3] = 2 || 3 || 4and

    $game_variables[3] = 2..4I thought it might be something like this, but not fully sure how it handles (these don't work).

    I though it might also be == but realised that this is only if is equal to all 3 values.

    Any help is great.
     
    #1
  2. Mr. Trivel

    Mr. Trivel Glasses Veteran

    Messages:
    284
    Likes Received:
    452
    First Language:
    Lithuanian
    You mean,

    $game_variables[3] == 2 || $game_variables[3] == 3 || $game_variables[3] == 4?

    Or you can use:

    Code:
    [2,3,4].include?($game_variables[3])
     
    Last edited by a moderator: Jun 23, 2014
    #2
    CrawlinUK likes this.
  3. CrawlinUK

    CrawlinUK Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Thanks, both work well.

    I will use the second as I can add to it later on.
     
    #3

Share This Page