Hello Guest

I need a little help with my script

  • 3 Replies
  • 152 Views
*

LCKNAM

  • *
  • 2
  • +0/-0
    • View Profile
I need a little help with my script
« 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

*

Seuntjie

  • *****
  • 489
  • +13/-2
    • View Profile
Re: I need a little help with my script
« Reply #1 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
your code
end

or

if (conditions) then
your code
else
your other code
end

*

LCKNAM

  • *
  • 2
  • +0/-0
    • View Profile
Re: I need a little help with my script
« Reply #2 on: June 20, 2020, 06:23:36 pm »
Thank you Seuntjie
I  had some progress. Just need to figure out some finer detail

*

Voodoohack

  • **
  • 13
  • +0/-0
    • View Profile
Re: I need a little help with my script
« Reply #3 on: August 01, 2020, 01:42:55 am »