Pages:
Author

Topic: Seuntjie' Dice bot programmers mode discussion. - page 50. (Read 125399 times)

legendary
Activity: 1717
Merit: 1125
LUA ERROR!!
')' expected, got '='

Code:
chance=49.5
multiplier=2.0
base=0.00000001
nextbet = base
wincount = 0
losecount = 0
resetstats = false
function dobet()

if (win) then
   wincount += 1
   nextbet=previousbet
else
   losecount += 1
   nextbet=previousbet*multiplier    
end
      if (wincount == 2  and currentprofit = <-0.00000050 and losecount= <5) then
      if (win nextbet = basebet)
end and then                                                                    
      resetstats = true
else    
         if (losecount == >5 and currentprofit = >-0.00000050)  then
         if (win  nextbet = basebet) end and  then                                                                          
       resetstats = true
         end            
end
end

Please start using the code box. Valid operators for ifs:
Equals ==
Not equals !=
larger than >
smaller than <
larger or equals to >=
small or equals to <=

Programming is consistent. even though it looks mostly the same = and == does not do the same thing. >= and => does not do the same thing (in fact the one works and the other doesn't). it's extremely important to be consistent with your code otherwise it won't work. Not just with the operators, if you're using variables and it has a capital letter in one place but not in the other, it's two separate variables.
legendary
Activity: 1007
Merit: 1000
legendary
Activity: 1007
Merit: 1000
(wincount == 2 and previousbet != basebet)

What does the "!" mean ?



chance = 39.6
martimulti = 40
basebet = .00000001
startbalance = balance
nextbet = basebet
savefactor = 1.25
target = .01
targetbalance = balance + target
bethigh = true
low = 0
high = 0
losecount = 0
stopnow = false
totallose = 0
wincount = 0
nextwinbet = basebet * martimulti
go = false
set = false


function dobet()


if (win) then
   wincount += 1
   totallose = 0
   newbalance = balance

   
    else
      bethigh = false
    end
  if (wincount == 1 and go) then
     nextbet = nextwinbet
     go = false
      set = false
  else
      nextbet = basebet
  end
   if (wincount == 2 and previousbet != basebet) then
      if (stopnow) then stop() end
        martimulti = 40
        nextwinbet = basebet * martimulti   
        set = true
       losecount = 0
      if (balance > targetbalance) then
         invest((balance - targetbalance)+target)
         targetbalance = targetbalance + target
         newbalance = targetbalance
      end
      if (newbalance > startbalance * savefactor) then
          invest(balance-startbalance)
          targetbalance = startbalance + target
          startbalance = startbalance * savefactor
      end
   end
    if (wincount == 2) then go = true end
 else
   if (wincount == 1 and previousbet != basebet ) then
      nextwinbet = previousbet * martimulti
      martimulti = martimulti / 2
      if (martimulti < 1.85) then martimulti = 1.85 end
      losecount += 1
      print(losecount)
   else
     
   end
   wincount = 0
   totallose = totallose + 1
   if (totallose == 2) then go = true end
   nextbet = basebet
 end
 
end

! is NOT.  So !=  means not equal.  That is when comparing.  You can also use it to flip a true/false value.  bethigh = !bethigh  changes bethigh from whatever it is to the other.  so low -> high or high -> low.
full member
Activity: 140
Merit: 100
Has anyone ever made a script that is sort of a random martingale? E.g. after every win, it selects a new bet multiplier and return?

e.g. runs on a 2x return with a bet multiplier of 2.5
then after its first win, runs on a 4x return with a 1.4x bet multiplier?
legendary
Activity: 1717
Merit: 1125
Your second if win statement is redundant.    So on a win your script first sets nextbet to the previousbet and then sets it to the base bet.  The else leg of that second if will never execute.  If the bet won based on the first if statement it will always be a win in the second. 

   I think you want to change the second "if win" to "if currentstreak == 2 then" and get rid of the else path.  That way on the first win currentstreak will be 1, and you will have set nextbet to the previousbet.  But when you have 2 wins in a row it will bet the basebet.   

as far as resetting the basebet based on balance.  What point do you want to do that?  after 1 win, only after 2 wins, or after more then 1 win.      You would just copy your setting from above, and either put it after nextbet = previousbet  if you want it for any win.  Or after the nextbet = basebet in the second if statement, if you want it only after 2 wins in a row.  If you want it after 2 or more wins.  you could change the second if statement to check "if currentstreak > 1"  that will cause that to execute each time you have more then 1 win in a row.

Ok, I thought the redundancy was necessary to execute the bet a second time.  I kind of figured that 'currentstreak' command had to be in there somewhere but wasn't quite sure where.  Shows how much of a programmer I am...  Tongue  The percentage thing was a head-scratcher for me, and your solution is stupid easy.  Your updated script is exactly what I was looking for though, thank you!

You don't need to use the programmer mode for this. You can use the advanced mode. If you un-tick the "reset to base bet after first win" option and set the bot to "after 2 wins, change bet to xxx" you could have had the same functionality.

But this doesn't allow the base bet to be a percentage of my balance, unless I can put code into the "after 2 wins..." box?  Another question for programmer mode; is there a sort of "stop on win" command that stops betting after the current cycle is finished instead of a dead 'stop()' in the middle of the cycle?

Oh right, now. Sorry I didn't see the percentage base bet thing. There's only the stop command, you'll have to write your own stop on win function. You can do it the same way as the bot does it. Have a stop on win variable that's set to false. If you want to stop on win, set it to true, then if both win and stop on win is true, stop.
sr. member
Activity: 321
Merit: 250
Your second if win statement is redundant.    So on a win your script first sets nextbet to the previousbet and then sets it to the base bet.  The else leg of that second if will never execute.  If the bet won based on the first if statement it will always be a win in the second. 

   I think you want to change the second "if win" to "if currentstreak == 2 then" and get rid of the else path.  That way on the first win currentstreak will be 1, and you will have set nextbet to the previousbet.  But when you have 2 wins in a row it will bet the basebet.   

as far as resetting the basebet based on balance.  What point do you want to do that?  after 1 win, only after 2 wins, or after more then 1 win.      You would just copy your setting from above, and either put it after nextbet = previousbet  if you want it for any win.  Or after the nextbet = basebet in the second if statement, if you want it only after 2 wins in a row.  If you want it after 2 or more wins.  you could change the second if statement to check "if currentstreak > 1"  that will cause that to execute each time you have more then 1 win in a row.

Ok, I thought the redundancy was necessary to execute the bet a second time.  I kind of figured that 'currentstreak' command had to be in there somewhere but wasn't quite sure where.  Shows how much of a programmer I am...  Tongue  The percentage thing was a head-scratcher for me, and your solution is stupid easy.  Your updated script is exactly what I was looking for though, thank you!

You don't need to use the programmer mode for this. You can use the advanced mode. If you un-tick the "reset to base bet after first win" option and set the bot to "after 2 wins, change bet to xxx" you could have had the same functionality.

But this doesn't allow the base bet to be a percentage of my balance, unless I can put code into the "after 2 wins..." box?  Another question for programmer mode; is there a sort of "stop on win" command that stops betting after the current cycle is finished instead of a dead 'stop()' in the middle of the cycle?
legendary
Activity: 1717
Merit: 1125
Your second if win statement is redundant.    So on a win your script first sets nextbet to the previousbet and then sets it to the base bet.  The else leg of that second if will never execute.  If the bet won based on the first if statement it will always be a win in the second. 

   I think you want to change the second "if win" to "if currentstreak == 2 then" and get rid of the else path.  That way on the first win currentstreak will be 1, and you will have set nextbet to the previousbet.  But when you have 2 wins in a row it will bet the basebet.   

as far as resetting the basebet based on balance.  What point do you want to do that?  after 1 win, only after 2 wins, or after more then 1 win.      You would just copy your setting from above, and either put it after nextbet = previousbet  if you want it for any win.  Or after the nextbet = basebet in the second if statement, if you want it only after 2 wins in a row.  If you want it after 2 or more wins.  you could change the second if statement to check "if currentstreak > 1"  that will cause that to execute each time you have more then 1 win in a row.

Ok, I thought the redundancy was necessary to execute the bet a second time.  I kind of figured that 'currentstreak' command had to be in there somewhere but wasn't quite sure where.  Shows how much of a programmer I am...  Tongue  The percentage thing was a head-scratcher for me, and your solution is stupid easy.  Your updated script is exactly what I was looking for though, thank you!

You don't need to use the programmer mode for this. You can use the advanced mode. If you un-tick the "reset to base bet after first win" option and set the bot to "after 2 wins, change bet to xxx" you could have had the same functionality.
sr. member
Activity: 321
Merit: 250
Your second if win statement is redundant.    So on a win your script first sets nextbet to the previousbet and then sets it to the base bet.  The else leg of that second if will never execute.  If the bet won based on the first if statement it will always be a win in the second. 

   I think you want to change the second "if win" to "if currentstreak == 2 then" and get rid of the else path.  That way on the first win currentstreak will be 1, and you will have set nextbet to the previousbet.  But when you have 2 wins in a row it will bet the basebet.   

as far as resetting the basebet based on balance.  What point do you want to do that?  after 1 win, only after 2 wins, or after more then 1 win.      You would just copy your setting from above, and either put it after nextbet = previousbet  if you want it for any win.  Or after the nextbet = basebet in the second if statement, if you want it only after 2 wins in a row.  If you want it after 2 or more wins.  you could change the second if statement to check "if currentstreak > 1"  that will cause that to execute each time you have more then 1 win in a row.

Ok, I thought the redundancy was necessary to execute the bet a second time.  I kind of figured that 'currentstreak' command had to be in there somewhere but wasn't quite sure where.  Shows how much of a programmer I am...  Tongue  The percentage thing was a head-scratcher for me, and your solution is stupid easy.  Your updated script is exactly what I was looking for though, thank you!
legendary
Activity: 1007
Merit: 1000
Looking for some help to clean up my code since it's not working like I want it to.  What I'm trying to write is a basic martingale bot for a 1.5x method that doubles on loss, but then repeats the last bet after a win.  Example of what I'm trying to accomplish here.

Code:
chance = 65
enablesrc=true
percentage=0.01
multiplier=2
base = balance*(percentage/100)
basebet = balance*(percentage/100)
nextbet = base
bethigh = false

function dobet()

    if win then
nextbet = previousbet

if win then
nextbet = basebet
else
nextbet = previousbet*multiplier
end
else
nextbet = previousbet*multiplier
end
end

The double on loss works fine, but it keeps resetting to the base bet after the first win.  Why is the "nextbet=previousbet" part not functioning like I want it to?

Also, setting my base bet as a percentage of my balance only does so at the start of running the script.  It doesn't refresh after every cycle like I want it to.  Any ideas if there's a fix for this too?

   Your second if win statement is redundant.    So on a win your script first sets nextbet to the previousbet and then sets it to the base bet.  The else leg of that second if will never execute.  If the bet won based on the first if statement it will always be a win in the second. 

   I think you want to change the second "if win" to "if currentstreak == 2 then" and get rid of the else path.  That way on the first win currentstreak will be 1, and you will have set nextbet to the previousbet.  But when you have 2 wins in a row it will bet the basebet.   

as far as resetting the basebet based on balance.  What point do you want to do that?  after 1 win, only after 2 wins, or after more then 1 win.      You would just copy your setting from above, and either put it after nextbet = previousbet  if you want it for any win.  Or after the nextbet = basebet in the second if statement, if you want it only after 2 wins in a row.  If you want it after 2 or more wins.  you could change the second if statement to check "if currentstreak > 1"  that will cause that to execute each time you have more then 1 win in a row.

This is what I think your going for. 

Code:
chance = 65
enablesrc=true
percentage=0.01
multiplier=2
base = balance*(percentage/100)
basebet = balance*(percentage/100)
nextbet = base
bethigh = false

function dobet()

    if win then
nextbet = previousbet

if (currentstreak > 1)then
                        basebet = balance*(percentage/100)     // if you put this here it updates basebet before setting nextbet
nextbet = basebet                              //  if you move it after here, nextbet is still the old value, but the next time it will be updated
        end
else
nextbet = previousbet*multiplier
end
end
sr. member
Activity: 321
Merit: 250
Looking for some help to clean up my code since it's not working like I want it to.  What I'm trying to write is a basic martingale bot for a 1.5x method that doubles on loss, but then repeats the last bet after a win.  Example of what I'm trying to accomplish here.

Code:
chance = 65
enablesrc=true
percentage=0.01
multiplier=2
base = balance*(percentage/100)
basebet = balance*(percentage/100)
nextbet = base
bethigh = false

function dobet()

    if win then
nextbet = previousbet

if win then
nextbet = basebet
else
nextbet = previousbet*multiplier
end
else
nextbet = previousbet*multiplier
end
end

The double on loss works fine, but it keeps resetting to the base bet after the first win.  Why is the "nextbet=previousbet" part not functioning like I want it to?

Also, setting my base bet as a percentage of my balance only does so at the start of running the script.  It doesn't refresh after every cycle like I want it to.  Any ideas if there's a fix for this too?
legendary
Activity: 1007
Merit: 1000
What's the difference between the following variables?

Profit
currentprofit
tmpprofit

  At the top of the code tab, in programmer mode, there is a list of available variables.  profit and curentprofit are listed there.  That is a list of variables already defined for your script.  RO can only be referenced RW can be changed. 

  I believe profit is your current session profit from the last resetstat call.  currentprofit is the profit from the last bet.  both could be + or -. 

tmpprofit is not used by the bot, but could be defined in your script.    a lot of time you may want to do something till you hit a set profit.  At the beginning of you script you could have tmpprofit += currentprofit. 

That would now keep a running total of you profit since tmpprofit was set.  Later you might check, if (tmpprofit > 4) then withdraw 3 and tmpprofit = 0.  Setting tmpprofit to zero starts your profit calculation over.   



So if I were to have


if currentprofit=-0.00000050 then


it would mean that once I have a negative value of 50 satoshi I would want the script to do something?

if currentprofit == -0.000000050 then       <----   This is saying check the last bets profit and if it's equal to -50 satoshi's then do something.   

(notice the double equal signs, you want to tell LUA this is a compare and not an assignment)

I normally have resetstats() above the function dobet()  Then you could have

if profit == -0.00000050 then

    To do something if my profit for this session has dropped to -50 satoshi's

so...

currentprofit  is the last bets profit and
profit is the sessions profit

Thanks to your help I think that I nearly go it.

Would you have any idea why it's throwing me that Error?

LUA ERROR!!
primary expression expected, got 'then'


chance=49.5
multiplier=2.0
base=0.00000001
nextbet = base 
bethigh = true
resetstats()
function dobet()

if win then
   nextbet=previousbet then
   Nextbet = base
end     
 
else
      nextbet=previousbet*multiplier
      if currentstreak==2 then nextbet = base end
   
 end
    
 else
     if currentprofit=-0.00000050 then
     if currentstreak==-1 then
     if win then next bet = basebet  end
     end
    
end
end

   I think you need to rethink your script. 

There are 2 flavors of the "if" statement. 

if (xyz) then
end

and

if (xyz) then
else
end


in you script you have

if win then
   nextbet=previousbet then
   Nextbet = base
end     
 
else

      Lua and I are both confused about what the else is.  Since you have an end for the first if, the else is just dangling out there. 

If you removed that first end after the first if, Lua would handle that first else, but then the next else would fail.   But at this point I'm lost as to what your trying to do. 

You may be missing the fact you can combine checks on 1 if statement so maybe

          if currentprofit=-0.00000050 then
     if currentstreak==-1 then
     if win then next bet = basebet  end
     end
should be
         if (currentprofit = -0.00000050 and currentstreak = -1 and win = true) then
              nextbet = basebet
         end

There is also a logical error.  you can never have currentprofit and currentstreak negative, and still win. 

   
since you can't go back and see what happened before, you can create a new variable, and set it when you reach your limit. Then in the win path when that variable is set you can reset the nextbet. 

 
legendary
Activity: 1717
Merit: 1125
What's the difference between the following variables?

Profit
currentprofit
tmpprofit


I came across the following code many pages back.

------------------------------

chance=77.7
multiplier=1.5
multiplier2=0.92
base=0.0000150
nextbet = base  
bethigh = false
target = .00005
investtarget = .001
tmpprofit = 0
investprofit = 0
wincount = 10
stopnow = false

function dobet()

tmpprofit += currentprofit
investprofit += currentprofit

   if win then
      if (tmpprofit > target) then
         tmpprofit = 0
         nextbet = base
         if(stopnow) then stop() end
         if(investprofit  > investtarget ) then
             investprofit = 0
             invest(investtarget)
         end      
      else
         nextbet=previousbet*multiplier2
         if(nextbet < base) then nextbet = base end
      end
   else
      nextbet=previousbet*multiplier
      if(nextbet < base) then nextbet = base end
   end
end

If only there were some kind of online resource that you could read that explained variables in DiceBot....

Oh, wait:

Edit: Sorry, I know the sarcasm isn't necessary, I just get annoyed that I create the resources and post them, but it gets ignored. A lot of your questions could have been answered if you read through the articles and referenced them when you had a problem. For example that a single = is assignment and double = (==) is a comparison, as explained in the third tutorial on steemit.
legendary
Activity: 1007
Merit: 1000
What's the difference between the following variables?

Profit
currentprofit
tmpprofit

  At the top of the code tab, in programmer mode, there is a list of available variables.  profit and curentprofit are listed there.  That is a list of variables already defined for your script.  RO can only be referenced RW can be changed. 

  I believe profit is your current session profit from the last resetstat call.  currentprofit is the profit from the last bet.  both could be + or -. 

tmpprofit is not used by the bot, but could be defined in your script.    a lot of time you may want to do something till you hit a set profit.  At the beginning of you script you could have tmpprofit += currentprofit. 

That would now keep a running total of you profit since tmpprofit was set.  Later you might check, if (tmpprofit > 4) then withdraw 3 and tmpprofit = 0.  Setting tmpprofit to zero starts your profit calculation over.   



So if I were to have


if currentprofit=-0.00000050 then


it would mean that once I have a negative value of 50 satoshi I would want the script to do something?

if currentprofit == -0.000000050 then       <----   This is saying check the last bets profit and if it's equal to -50 satoshi's then do something.   

(notice the double equal signs, you want to tell LUA this is a compare and not an assignment)

I normally have resetstats() above the function dobet()  Then you could have

if profit == -0.00000050 then

    To do something if my profit for this session has dropped to -50 satoshi's

so...

currentprofit  is the last bets profit and
profit is the sessions profit
legendary
Activity: 1007
Merit: 1000
What's the difference between the following variables?

Profit
currentprofit
tmpprofit

  At the top of the code tab, in programmer mode, there is a list of available variables.  profit and curentprofit are listed there.  That is a list of variables already defined for your script.  RO can only be referenced RW can be changed. 

  I believe profit is your current session profit from the last resetstat call.  currentprofit is the profit from the last bet.  both could be + or -. 

tmpprofit is not used by the bot, but could be defined in your script.    a lot of time you may want to do something till you hit a set profit.  At the beginning of you script you could have tmpprofit += currentprofit. 

That would now keep a running total of you profit since tmpprofit was set.  Later you might check, if (tmpprofit > 4) then withdraw 3 and tmpprofit = 0.  Setting tmpprofit to zero starts your profit calculation over.   
legendary
Activity: 1007
Merit: 1000
LUA ERROR!!
assignment statement expected, got 'function'



chance=49.5
multiplier=2
base=0.00000010
nextbet = base   
bethigh = false
stoponwin

function dobet()
   if win then
      if (stoponwin) then stop() end -- check new variable.   
      nextbet=base
   else
      nextbet=previousbet*multiplier
   end
end
end

   The function mentioned in the error, is the dobet() function.  So look at the statement just before it.  stoponwin is not valid for an assignment statement.  You need to tell LUA what stoponwin is equal to.  I think you want stoponwin = true

sr. member
Activity: 1344
Merit: 335
#SWGT PRE-SALE IS LIVE
I have my script set up so that I have to bet & win same amount two times in a row in order to return to base bet.

Yet how would I set up the script so that after I were to lose so much coins, instead of requiring the dice bot win two times in a row to return to base bet, the dice bot would return to base bet after winning once?
legendary
Activity: 1717
Merit: 1125
LUA ERROR!!
'end' expected, got ''




chance=49.5
multiplier=2.0
base=0.00000001
function dobet()

if win then

   nextbet=baseBet

else

   nextbet=previousbet*multiplier

end

   nextbet = previousbet

   if currentstreak==2 then

   nextbet=baseBet

else

   if currentstreak==-9 then
   
   if win then

   nextbet=baseBet

end
end




Every function, if or if-else needs an end:

Code:
chance=49.5
multiplier=2.0
base=0.00000001
(1)function dobet()

(2)if win then

nextbet=baseBet

(2)else

nextbet=previousbet*multiplier

(2)end

nextbet = previousbet

(3) if currentstreak==2 then

nextbet=baseBet

(3)else

(4) if currentstreak==-9 then

(5) if win then

nextbet=baseBet

(5)end
(4)end
legendary
Activity: 1717
Merit: 1125
LUA ERROR!!
assignment statement expected, got 'losses'

chance=49.5
multiplier=2.0
base=0.00000001
function dobet()

if win then

   nextbet=baseBet

else

   nextbet=previousbet*multiplier

end

   nextbet = previousbet

   if currentstreak==2 then

   nextbet=baseBet

else

   If losses=0.000005 then
   
   if win then

   nextbet=baseBet

end
end

What's the difference between this line that works:
if currentstreak==2 then


and this line that doesn't:
If losses=0.000005 then

Also, take another look at the variables appendix (01.2 linked in my previous post)
losses is the NUMBER of losing bets, not the profit.
newbie
Activity: 4
Merit: 0
I want to set automatic my strategy, but i have one problem, the base bet is 0.00000001 and chance 42%. When hit 6 lose streak the base bet change to 0.00000100, and if i lose again, and hit 7 lose streak, the base bet reset to 0.00000001 and the next 6 lose streak the base bet will change to 0.00000200 (double). The problem is, everything is automatic, less the double part, so how i double the "increased" bet if i lose the 7 time?

Strategy Example:

win - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000100
win - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000200
lose - 0.00000001
win -  0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
lose - 0.00000001
win - 0.00000400

Configured in "Advanced Mode":
http://image.prntscr.com/image/d205c40823b649f59696eac09bb49a8e.png
http://image.prntscr.com/image/7185b151672948a2a1797f8f63a95836.png

I tried these codes:
Code:
function dobet()

baseBet=0.00000001
streakBet1=0.0000001

if win then

 nextbet=0.00000001

else

 nextbet=baseBet

end
if currentstreak==-6 then

 nextbet=streakBet1

if win then

streakBet1=0.0000001

else

setvalueint(streakBet1,double)

end

end

end

end

and

Code:
function dobet()

baseBet=0.00000001
streakBet1=0.0000001

if win then

 nextbet=0.00000001

else

 nextbet=baseBet

end
if currentstreak==-6 then

 nextbet=streakBet1

if win then

streakBet1=0.0000001

else

streakBet1=streakBet1*2

end

end

end

end
Pages:
Jump to: