Post
Topic
Board Gambling discussion
Re: Seuntjie' Dice bot programmers mode discussion.
by
HCP
on 22/06/2017, 01:35:21 UTC
I want to add a function when x is lost, add a bet.
I assume you mean that when x < 100, and the "random" bet is made and loses... that you want to be able to do something specific?

In that case, add a boolean flag that indicates whether or not the last bet was an "x" bet...

Code:
basebet=0.1
bchance=93
chance=bchance
nextbet=basebet
maxbet=100
minbet=100
maxchance=93
minchance=93
randomc=100

bettingX = false

function dobet()
  if not bettingX then
    bethigh= math.random(0,1000)%2==0
    x=math.random(0,10000)
    if x < randomc then
      nextbet = math.random(minbet,maxbet)
      chance=math.random(minchance*100,maxchance*100)/100
      bettingX = true
    else
      nextbet = basebet
      chance=bchance
      bettingX = false
    end
  else
    if not win then
      --Your X bet just lost, so "add your bet" here
      .. add a bet ..
      bettingX = true ?? I don't know if you want to continue adding bets or not, you didn't say
    else
      -- guessing you want it to reset on a win?
      nextbet = basebet
      chance=bchance
      bettingX = false
    end
  end
end

hello, i would like to simply know how to add a time delay to my script, for example, to delay for say 1minute after an action , before commencing another one

you should be able to put in a simple blocking delay using something like:

Code:
delay = 60 -- measured in seconds

local start = os.clock()
while os.clock() - start < delay do end