Hello Guest

High Low Array

  • 9 Replies
  • 634 Views
*

COBIDEK282

  • **
  • 8
  • +0/-0
    • View Profile
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

  • *****
  • 584
  • +17/-3
    • View Profile
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[1])

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

*

COBIDEK282

  • **
  • 8
  • +0/-0
    • View Profile
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

  • *****
  • 584
  • +17/-3
    • View Profile
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 it
x = {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
    • View Profile
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]
    end
bethigh = z

*

COBIDEK282

  • **
  • 8
  • +0/-0
    • View Profile
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]
    end
bethigh = z

someone explain why it is not working in array sequence

*

Voodoohack

  • **
  • 17
  • +0/-0
    • View Profile
Re: High Low Array
« Reply #6 on: February 06, 2021, 02:36:09 pm »
Code: [Select]
enablezz = false
enablesrc = false
bethigh = true
bb = 0.0001
chance = 50
Var1 = 1
Var6 = 1
Var2 = 0
Var3 = 1
Var5 = true
nextbet = bb
nex = 1
bal = 0
Var4 = true
last = {}
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
    end
end

*

COBIDEK282

  • **
  • 8
  • +0/-0
    • View Profile
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 ;D

Code: [Select]
hilo = 1
function dobet()

if hilo==1 then
bethigh = false
hilo = 2
end

if hilo==2 then
bethigh = true
hilo = 3
end

if hilo==3 then
bethigh = false
hilo = 4
end

if hilo==4 then
bethigh = false
hilo = 5
end

if hilo==5 then
bethigh = true
hilo = 6
end


if hilo==6 then
bethigh = false
hilo = 7
end

if hilo==7 then
bethigh = true
hilo = 8
end

if hilo==8 then
bethigh = true
hilo = 1
end
« Last Edit: February 07, 2021, 04:15:43 am by COBIDEK282 »

*

Voodoohack

  • **
  • 17
  • +0/-0
    • View Profile
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
    • View Profile
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]
    end
bethigh = 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 += 1
x = {false, true, false, false, true, false, true, true}

if count >= 8 then
    count = 0
end
   
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 »