Hello Guest

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

• 2 Replies
• 66 Views

#### Bullseye

• 37
• +0/-0
##### What is wrong w/ this simple if/then? Place only one bet differently
« on: May 18, 2020, 11:21:26 pm »
I am stumped on this one.

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

Code: [Select]
`yawnchance=49.500funbank=99funprofit=funbankfunbet=33.33funchance=33.33000----------dobet here----------if profit    >= funprofit and lastBet.chance = chance then   nextbet   = funbet   chance    = funchance   funprofit = funprofit + funbankelse chance = yawnchanceend`
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

• 468
• +13/-2
##### Re: What is wrong w/ this simple if/then? Place only one bet differently
« Reply #1 on: May 19, 2020, 07:05:17 am »
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
##### Re: What is wrong w/ this simple if/then? Place only one bet differently
« Reply #2 on: May 24, 2020, 02:34:02 pm »
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