Hello Guest

coding a seperate martingale loop

  • 2 Replies
  • 600 Views
*

skfxf4e

  • *
  • 3
  • +0/-0
    • View Profile
coding a seperate martingale loop
« on: June 08, 2018, 01:13:53 pm »
Hi,
I am really new to scripting in general and also to dicebot. However, Im attempting to create a script which does the following -

1. Checks if win or loss
2. If win then rolls again with same bet size
3. If loss then increases the bet size by predetermined %
4. If a loss streak of 20 occurs then reduce bet size to 0 until a win occurs
5. Once we have 1 win following a loss streak greater than 20 then start with a bet size of 10x the first original betsize
6. Once a win occurs, we revert back to the 1st base bet size and do all over again

The part which I am having trouble with is point 5. I've scripted everything else successfully but for the life of me, cannot figure out how to make the increase and then revert back to the original bet size after the next win. Please check out my code below, and if you can help. I would be eternally grateful! NOTE: I am new at this so I apologize if my code is messy or confusing. Thanks!
-Knight-
--------------------------------------------------------------
Code: [Select]
chance=10
multiplier=1.22
multiplier2=1.11
base=(balance*0.0002)
martybase=(balance*0.002)
nextbet=base
huntlvl=-20
winhunt=0
fullmarty=0
lossstreak=0
newstart=0

function dobet()



if win then

nextbet=base

else
if currentstreak < huntlvl then
lossstreak=1
else
lossstreak=0

if lossstreak==1 then

nextbet=0.00000000
fullmarty=1

if win and fullmarty==1 then

lossstreak=0
nextbet=base*martybase

end
else

nextbet=previousbet*multiplier2


end

end
end
-----------------------------------
« Last Edit: June 08, 2018, 02:30:12 pm by Seuntjie »

*

Seuntjie

  • *****
  • 261
  • +2/-2
    • View Profile
Re: coding a seperate martingale loop
« Reply #1 on: June 08, 2018, 02:58:09 pm »
For a newbie, your code is really good. Your use of variables, grouping of calculations and statements and thought process throughout the code are all very similar to someone that has programming experience, but there are some obvious errors (like the missing end and using ints instead of bools). Take a look at some of the programmer mode tutorials on https://forum.seuntjie.com/index.php?topic=2.0


Something that I do quite often when writing complex pieces of code is to draw out a decision tree in my head, but drawing one on paper is also a really good exercise. Indenting your code also usually helps a bit for this (see https://www.youtube.com/watch?v=RlxPCWG3zD8&index=4&list=PLZH88mwZAXLxVtHpc3PIFamkiT1o2V3LX&t=597s on how to use another IDE/editer to edit the script and run it from DiceBot without having to copy and paste code the while time). If you draw a decision tree for this code, you'll notice an if statement that will never be true:

You check whether it is a win or not. If is not, do a few things. Included in these things is a check to see whether or not it was a winning bet, and if it is, do something. This if will never be executed because you already established it's a loss. You basically only need to move that if statement somewhere else.

Also take a look at nextbet=base*martybase. How is the value for base determined? and how is the value for martybase determined? what is the resulting value going to be?


Thought experiment: You get 20 losses in a row. fullmarty is set to 1. Your bet is set to 0 and you continue betting. You get a win and you reset to 10x your original base, the you lose a few bets and your multiplier is used etc etc and you win a bet. To what value is your bot going to reset?

PS: Please use the code tags in the future.

*

skfxf4e

  • *
  • 3
  • +0/-0
    • View Profile
Re: coding a seperate martingale loop
« Reply #2 on: June 10, 2018, 07:05:09 pm »
Thank you so much!! Your advice was perfect! My script is now fully working. Also, your point about the decision tree was awesome and has helped greatly. Thanks again man!

-Knight-