Help me with this code

Discussion in 'Programming' started by Afrent, Oct 10, 2019.

  1. Afrent

    Afrent Member

    Joined:
    Oct 9, 2019
    Posts:
    3
    I am making a machine if you click on it then its gonna add number by the rarity and the humian value but the left_pressed event is not working
    Step event script:
    //Check if

    if rarity = 1 {
    if humian = 1
    {
    global.huminan += 1;
    rarity = 0;
    humian = 0;
    }
    else if humian = 2
    {
    global.huminan += 2;
    rarity = 0;
    humian = 0;
    }
    else if humian = 3
    {
    global.huminan += 3;
    rarity = 0;
    humian = 0;
    }
    }else if rarity = 2 {
    if humian = 1
    {
    global.huminan += 4;
    rarity = 0;
    humian = 0;
    }
    else if humian = 2
    {
    global.huminan += 5;
    rarity = 0;
    humian = 0;
    }
    else if humian = 3
    {
    global.huminan += 6;
    rarity = 0;
    humian = 0;
    }
    }
    left pressed event script:
    rarity = random_range(1,2);
    humian = random_range(1,3);
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,556
    random_range() can give fractional values that won't match your integer-based cases, use irandom_range() instead.
     
    ParodyKnaveBob likes this.
  3. Afrent

    Afrent Member

    Joined:
    Oct 9, 2019
    Posts:
    3
    I just saw that humian variable is spelled wrong.
     
  4. Afrent

    Afrent Member

    Joined:
    Oct 9, 2019
    Posts:
    3
    thank you it really help and very quickly to
     
    ParodyKnaveBob likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice