Hello Guest

# High Low Array

• 9 Replies
• 1018 Views #### COBIDEK282

•  • 8
• +0/-0 ##### High Low Array
« on: January 24, 2021, 04:55:57 pm »
I am total noob. Trying to figure out how to use array values. Tried myself but couldn't find any solution. Please help a noob! Code: [Select]
`x = {false, true, false, false, true, false, true, true}bethigh = -- How to get [x] sequence ??` #### Seuntjie

•     • 593
• +17/-3 ##### Re: High Low Array
« Reply #1 on: January 25, 2021, 08:43:28 am »
Have you looked at https://www.lua.org/pil/11.1.html?

you access an item from the array using x[index] (for example x)

How you decide which index to access depends on you and your code. #### COBIDEK282

•  • 8
• +0/-0 ##### Re: High Low Array
« Reply #2 on: January 25, 2021, 11:59:57 am »
why below code is not working? Code: [Select]
`x = {false, true, false, false, true, false, true, true}    i     = i+1    for i = 0, 7 do        x[i] = 0    end    bethigh = x` #### Seuntjie

•     • 593
• +17/-3 ##### Re: High Low Array
« Reply #3 on: January 25, 2021, 12:13:47 pm »
Code: [Select]
`--x is a basket (array) with 8 eggs (boolean) inside of itx = {false, true, false, false, true, false, true, true}     i     = i+1    for i = 0, 7 do--for every egg in the basket x, replace that egg with an apple (number)        x[i] = 0    end--replace the egg called bethigh with a basket called x that is full of apples    bethigh = x`
https://youtu.be/ldjAN3YXRMc #### COBIDEK282

•  • 8
• +0/-0 ##### Re: High Low Array
« Reply #4 on: January 25, 2021, 01:31:11 pm »
only changes once high to low or vice versa Code: [Select]
`x = {false, true, false, false, true, false, true, true}    for i = 0, 7 do        z = x[i]    endbethigh = z` #### COBIDEK282

•  • 8
• +0/-0 ##### Re: High Low Array
« Reply #5 on: January 26, 2021, 12:43:42 pm »
only changes once high to low or vice versa Code: [Select]
`x = {false, true, false, false, true, false, true, true}    for i = 0, 7 do        z = x[i]    endbethigh = z`

someone explain why it is not working in array sequence #### Voodoohack

•  • 17
• +0/-0 ##### Re: High Low Array
« Reply #6 on: February 06, 2021, 02:36:09 pm »
Code: [Select]
`enablezz = falseenablesrc = falsebethigh = truebb = 0.0001chance = 50Var1 = 1Var6 = 1Var2 = 0Var3 = 1Var5 = truenextbet = bbnex = 1bal = 0Var4 = truelast = {}chan = {}function dobet()    if (Var5) == true then        last[(20)] = 0        last[(19)] = 0        last[(18)] = 0        last[(17)] = 0        last[(16)] = 0        last[(15)] = 0        last[(14)] = 0        last[(13)] = 0        last[(12)] = 0        last[(11)] = 0        last[(10)] = 0        last[(9)] = 0        last[(8)] = 0        last[(7)] = 0        last[(6)] = 0        last[(5)] = 0        last[(4)] = 0        last[(3)] = 0        last[(2)] = 0        last[(1)] = 0        Var5 = false    else        c = last[(20)]        b = last[(19)]        a = last[(18)]        aa = last[(17)]        ab = last[(16)]        ac = last[(15)]        ad = last[(14)]        ae = last[(13)]        af = last[(12)]        ag = last[(11)]        ah = last[(10)]        ai = last[(9)]        aj = last[(8)]        ak = last[(7)]        al = last[(6)]        am = last[(5)]        an = last[(4)]        ao = last[(3)]        ap = last[(2)]        aq = last[(1)]        if (lastBet.roll) >= 0 then            last[(20)] = (lastBet.roll)            last[(19)] = c            last[(18)] = b            last[(17)] = a            last[(16)] = aa            last[(15)] = ab            last[(14)] = ac            last[(13)] = ad            last[(12)] = ae            last[(11)] = af            last[(10)] = ag            last[(9)] = ah            last[(8)] = ai            last[(7)] = aj            last[(6)] = ak            last[(5)] = al            last[(4)] = am            last[(3)] = an            last[(2)] = ao            last[(1)] = ap        end        if (Var4) == true then            xy = last[(20)]            xz = last[(19)]            x = last[(18)]            xa = last[(17)]            xb = last[(16)]            xc = last[(15)]            xd = last[(14)]            xe = last[(13)]            xf = last[(12)]            xg = last[(11)]            xh = last[(10)]            xi = last[(9)]            xj = last[(8)]            xk = last[(7)]            xl = last[(6)]            xm = last[(5)]            xn = last[(4)]            xo = last[(3)]            xp = last[(2)]            xq = last[(1)]            gg = xy + xz + x + xa + xb + xc + xd + xe + xf + xg + xh + xi + xj + xk + xl + xm + xn + xo + xp + xq        end        if (gg) / 20 <= 45 then            bethigh = true        elseif (gg) / 20 >= 55 then            bethigh = false        end    endend` #### COBIDEK282

•  • 8
• +0/-0 ##### Re: High Low Array
« Reply #7 on: February 07, 2021, 03:59:54 am »
What all this?
I was trying to optimize this code and you made it more complex Code: [Select]
`hilo = 1function dobet()if hilo==1 thenbethigh = falsehilo = 2endif hilo==2 thenbethigh = truehilo = 3endif hilo==3 thenbethigh = falsehilo = 4endif hilo==4 thenbethigh = falsehilo = 5endif hilo==5 thenbethigh = truehilo = 6endif hilo==6 thenbethigh = falsehilo = 7endif hilo==7 thenbethigh = truehilo = 8endif hilo==8 thenbethigh = truehilo = 1end`
« Last Edit: February 07, 2021, 04:15:43 am by COBIDEK282 » #### Voodoohack

•  • 17
• +0/-0 ##### Re: High Low Array
« Reply #8 on: February 07, 2021, 07:27:32 pm »
Last one doesn't work this way #### ahamshep

• • 2
• +0/-0
• It's getting Hairy out there! ##### Re: High Low Array
« Reply #9 on: May 11, 2021, 07:25:57 pm »
only changes once high to low or vice versa Code: [Select]
`x = {false, true, false, false, true, false, true, true}    for i = 0, 7 do        z = x[i]    endbethigh = z`

someone explain why it is not working in array sequence

I'm not sure if you solved this already.  Your for loop is probably working fine, but it is looping to the end and giving you the last result.  since the dicebot executues the dobet function in a loop already you don't really need another loop, you just need a way to iterate through your array.

for example you could use a couple if statements and a counter.

Code: [Select]
`count += 1x = {false, true, false, false, true, false, true, true}if count >= 8 then    count = 0end    bethigh = x[count]`
this should iterate through your array and reset once the count hits 8 "the number of elements in your array"
« Last Edit: May 11, 2021, 07:27:32 pm by ahamshep »