Hello Guest

Recurring Chance

  • 3 Replies
  • 199 Views
*

koxasa6

  • *
  • 2
  • +0/-0
    • View Profile
Recurring Chance
« on: April 22, 2020, 03:45:55 pm »
I tried to write code for specific recurring chance but failed.
I want chance to keep rolling in loop regardless of win or lose.

 need help to get chance like this
chance 40 chance 45 chance 50 chance 40 chance 45 chance 50
then again after chance 50 => 40,45,50
chance 40 chance 45 chance 50 chance 40 chance 45 chance 50
Can someone please help me out with this :'(
« Last Edit: April 22, 2020, 06:24:26 pm by Seuntjie »

*

Seuntjie

  • *****
  • 481
  • +13/-2
    • View Profile
Re: Recurring Chance
« Reply #1 on: April 22, 2020, 03:50:51 pm »
Take a look at this tutorial: https://forum.seuntjie.com/index.php?topic=2.msg2086#msg2086

If you haven't yet, look at the other tutorials in that forum as well.

*

koxasa6

  • *
  • 2
  • +0/-0
    • View Profile
Re: Recurring Chance
« Reply #2 on: April 22, 2020, 06:14:22 pm »
@Seuntjie
It worked thanks for thread link

Code: [Select]
cc = 0
fd()

    cc +=  1
       
        if (cc%1 == 0) then
            chance = 40
        end
   
        if (cc%2 == 0) then
            chance = 45
        end
   
        if (cc%3 == 0) then
            chance = 50
            cc = 0
        end
end
« Last Edit: April 22, 2020, 06:24:06 pm by Seuntjie »

*

Seuntjie

  • *****
  • 481
  • +13/-2
    • View Profile
Re: Recurring Chance
« Reply #3 on: April 22, 2020, 06:23:34 pm »
This isn't the approach I had in mind when I suggested the modulo operator, but it's a valid and working one, so good job on figuring it out!.


You don't need to track or reset the number of bets you made unless you're implementing alternative logic as to when reset it. This is what I had in mind when I read your question:

Code: [Select]
nextbet=0.00000001
function dobet()
if bets%3==1 then
 chance=40
elseif bets%3==2 then
 chance =45
else chance=50
end
end