Hello Guest

What is wrong w/ this simple if/then? Place only one bet differently

  • 2 Replies
  • 147 Views
*

Bullseye

  • **
  • 37
  • +0/-0
    • View Profile
I am stumped on this one.

Trying to place one (and only one) special bet if the profit reaches X.

Code: [Select]
yawnchance=49.500
funbank=99
funprofit=funbank
funbet=33.33
funchance=33.33000
----------
dobet here
----------
if profit    >= funprofit and lastBet.chance = chance then
   nextbet   = funbet
   chance    = funchance
   funprofit = funprofit + funbank
else chance = yawnchance
end

it is the part after the "and" that seems to get ignored.  i've tried
"and lastBet.amount != 33.33000"
"and lastBet.chance !=33.33000"
"and lastBet.chance > 33.33000"

I'm sure i'm missing something simple, but i just can see it.  It does the one bet at funbet, then reverts back to base, but the chances stays at 33.33000

« Last Edit: May 18, 2020, 11:23:21 pm by Bullseye »

*

Seuntjie

  • *****
  • 481
  • +13/-2
    • View Profile
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

Lastly, programming is case sensitive. lastBet.chance is not the same thing as lastBet.Chance. An easy way to test whether you are using the correct name is to print it out:
Code: [Select]
print(lastBet.Chance)

*

Bullseye

  • **
  • 37
  • +0/-0
    • View Profile
Have you worked through the tutorials on https://forum.seuntjie.com/index.php?topic=2.0?

I have.  just got a bit lazy with my scripting.   I've been jumping between this, HTML, PHP for various projects and got soft.  Thanks for the kick in the ass  :)