# Seuntjies DiceBot

## DiceBot => Programmer Mode => Topic started by: LCKNAM on June 20, 2020, 02:34:34 pm

Title: I need a little help with my script
Post by: LCKNAM on June 20, 2020, 02:34:34 pm
I wrote the following short script but got the following error
LUA ERROR!!
'then' expected, got '='

Can someone fix this for me? I'm not a programmer and have zero experience LOL. Can't seems to find the problem?

The script basically bets with a 60% chance and double the bet on a lost but place the same amount bet after a win and after 7 losses in a row change the chance to 70%. It is also supposed to change the chance back to 60% after a double win on 70%

Thank you, I'll appreciate any help :)

This is the script I am trying to write;

bethigh = true
chance = 60
base = 0.00000002
nextbet = base
winafterloss = 0

function dobet()

if win then
if previousbet > base then winafterloss = 1
if winafterloss = 1 then nextbet = previousbet
if winafterloss = 0 then nextbet = base
if nextbet = base then chance = 60
else
winafterloss = 0
nextbet = previousbet * 2
if currentstreak > -7 then chance = 70
if currentstreak > -7 then nextbet = previousbet * 2.5
end
end
Title: Re: I need a little help with my script
Post by: Seuntjie on June 20, 2020, 02:44:03 pm
Have you worked through the tutorials on https://forum.seuntjie.com/index.php?topic=2.0? Specifically the steemit ones?

From https://steemit.com/dicebot/@seuntjie/dicebot-programmer-mode-tutorial-03-martingale
Quote
In programming, we don't use = to check whether values are equal to each other, we use ==. A single equals sign is used to assign values, a double is to compare values.

So x=3 sets the value of x to 3. x==3 checks whether x is equal to 3

Also, every time you use an if, you MUST use an and afterwards.
Quote
if (conditions) then
end

or

if (conditions) then