Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's a better way to keep track of a total count?

Asked by
Bruvis 1
3 years ago

I have a system that opens rolls 3 numbers and adds it to a counter of each rarity. They add to a count depending on what it rolls, but it seems like there's too much going on is there a better way to do this?

    local roll1 = math.random(1, 100)
    local roll2 = math.random(1, 100)
    local roll3 = math.random(1, 100)

    if roll1 <= 65 then
        cCardCount = cCardCount + 1
    elseif roll1 > 65 and roll1 <= 85  then
        rCardCount = rCardCount + 1
    elseif roll1 > 85 and roll1 <= 99 then
        eCardCount = eCardCount + 1
    else roll1 = 100
        lCardCount = lCardCount + 1
    end

    if roll2 <= 65 then
        cCardCount = cCardCount + 1
    elseif roll2 > 65 and roll2 <= 85  then
        rCardCount = rCardCount + 1
    elseif roll2 > 85 and roll2 <= 99 then
        eCardCount = eCardCount + 1
    else roll2 = 100
        lCardCount = lCardCount + 1
    end

    if roll3 <=65 then
        cCardCount = cCardCount + 1
    elseif roll3 > 65 and roll3 <= 85  then
        rCardCount = rCardCount + 1
    elseif roll3 > 85 and roll3 <= 99 then
        eCardCount = eCardCount + 1
    else roll3 = 100
        lCardCount = lCardCount + 1

Answer this question