Post
Topic
Board Gambling discussion
Re: Seuntjie' Dice bot programmers mode discussion.
by
chilly2k
on 29/07/2017, 03:24:31 UTC
So, I wanted to make script that bets on 50x payout and changes side every two wins. I also wanted it to double basebet after reaching given balance.

Code:
chance=2.00
nextbet=0.00000073
bethigh= false

function dobet ()

If win then
wincount == wincount + 1
if wincount == 2 then
if bethigh = false then
bethigh = true
else
bethigh = false
end
wincount == 0
end
end

if balance > 0.001 then
nextbase = nextbase*2
end

Unfortunately I get 'LUA ERROR!! assignment statement expected, got 'win'' tho I saw many examples here with 'if win then' line and everything seemed to be ok. I must admit this is a bit frustrating. Would anyone be so kind and check it for me please?


As always...pls use code tags.
You used double equals but needed to use single ones and the other way around.
Additionally you were missing an end at the very end of your script. formatting helps finding those easy mistakes.

Code:
chance=2.00
nextbet=0.00000073
bethigh= false

function dobet ()

  If win then
    wincount = wincount + 1         -- only one '=' if you want to assign and not equate
    if wincount == 2 then
      if bethigh == false then          -- this one actually needs a double '='
bethigh = true
      else
bethigh = false
      end
      wincount = 0                         -- same as above
    end
  end

  if balance > 0.001 then
    nextbase = nextbase*2
  end
end                                             -- missing end

What B4RF said.  Also   

  If win then      is not the same as
  if win then     

Lua does not know what If is.  So it's expecting it to be a variable and looking for an Equal sign to follow.