Pages:
Author

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

legendary
Activity: 1007
Merit: 1000

It's close.  Any idea what would give this error "input:18: unexpected symbol near '!'" ?  So it looks like "(!win)" is the opposite of (win).  But when I run it in the Lua demo (http://www.lua.org/cgi-bin/demo)  it doesn't like it.  

I thought in order to do the opposite we just do "not"  so instead of "!win" it would be "not win" but if I do that it just bets the same bet over and over instead of doing martingale.  

    The problem wasn't the !win.  Lua was expecting an end for the "if win" Statement.  I was trying to leave your logic the same but missed that end statement.  So the code is

Code:

chance=49.5
multiplier=2
base=0.00001000
resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle += lastBet.Profit

   if (win) then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   end   --  Missing end statement
   if (!win) then
      nextbet=previousbet*multiplier
   end

end


   Personally I would have handled the !win part in an else path.  But to each there own, and it's better that you understand what it's doing then I. 
 
 

Should I be able to see the simulator pause or stop with the "sleep(300000)" command in there?  Or does that only work when it's running real bets?   When I run the sim, martingale works correctly but I don't see any sleep.

  Did you cut/paste the above script?  Simulator will wait/loop.  It actually hangs the bot with the spinning circle thingy....

Are you incrementing profitsincelastcycle?  Are you checking the same variable?  You can check things out on the console.  type "print(profitsincelastcycle)"  no quotes, to see what that variable contains. 
legendary
Activity: 2296
Merit: 1031

It's close.  Any idea what would give this error "input:18: unexpected symbol near '!'" ?  So it looks like "(!win)" is the opposite of (win).  But when I run it in the Lua demo (http://www.lua.org/cgi-bin/demo)  it doesn't like it.  

I thought in order to do the opposite we just do "not"  so instead of "!win" it would be "not win" but if I do that it just bets the same bet over and over instead of doing martingale.  

    The problem wasn't the !win.  Lua was expecting an end for the "if win" Statement.  I was trying to leave your logic the same but missed that end statement.  So the code is

Code:

chance=49.5
multiplier=2
base=0.00001000
resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle += lastBet.Profit

   if (win) then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   end   --  Missing end statement
   if (!win) then
      nextbet=previousbet*multiplier
   end

end


   Personally I would have handled the !win part in an else path.  But to each there own, and it's better that you understand what it's doing then I. 
 
 

Should I be able to see the simulator pause or stop with the "sleep(300000)" command in there?  Or does that only work when it's running real bets?   When I run the sim, martingale works correctly but I don't see any sleep.
legendary
Activity: 1007
Merit: 1000

It's close.  Any idea what would give this error "input:18: unexpected symbol near '!'" ?  So it looks like "(!win)" is the opposite of (win).  But when I run it in the Lua demo (http://www.lua.org/cgi-bin/demo)  it doesn't like it.  

I thought in order to do the opposite we just do "not"  so instead of "!win" it would be "not win" but if I do that it just bets the same bet over and over instead of doing martingale.  

    The problem wasn't the !win.  Lua was expecting an end for the "if win" Statement.  I was trying to leave your logic the same but missed that end statement.  So the code is

Code:

chance=49.5
multiplier=2
base=0.00001000
resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle += lastBet.Profit

   if (win) then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   end   --  Missing end statement
   if (!win) then
      nextbet=previousbet*multiplier
   end

end


   Personally I would have handled the !win part in an else path.  But to each there own, and it's better that you understand what it's doing then I. 
 
 
legendary
Activity: 2296
Merit: 1031

Lua is a fickle language.  Your problem is not with the sleep.  resetseed is a function.  Your treating it as a variable.  If you really want to reset the seed just code resetseed()  It doesn't take a parm.   I think there was a discussion about passing in the client seed at some point but not yet.  

also profitsincelastcycle is an undefined variable.  Lua throws up on those too.

Try this
Code:

chance=49.5
multiplier=2
base=0.00001000
resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle += lastBet.Profit

   if (win) then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   if (!win) then
      nextbet=previousbet*multiplier
   end

end

 
   The only thing missing in the above code is what to set nextbet to when you hit your profit cycle.  Currently it will just end up being whatever it's set to.  

And I made the mistake of doing the sleep(30000) and running the simulator.  It hung for 30 seconds each time it hit that.  Basically hung up the bot.  So thats not a true sleep.  More a loop for that many seconds.    

It's close.  Any idea what would give this error "input:18: unexpected symbol near '!'" ?  So it looks like "(!win)" is the opposite of (win).  But when I run it in the Lua demo (http://www.lua.org/cgi-bin/demo)  it doesn't like it.  

I thought in order to do the opposite we just do "not"  so instead of "!win" it would be "not win" but if I do that it just bets the same bet over and over instead of doing martingale.  

EDIT::::  This solved it I think, http://www.dev-hq.net/lua/6--logical-operators  Just have to set the boolean variable to true and then you can use the "not" operator.

holy sh!t if it works lol.  I'm testing

EDIT2::  My test failed.  idk... here's what I ran.  It runs the bot but it doesn't do martingale... just bets the same thing over and over:

Code:
chance=49.5
multiplier=2
base=0.00001000
function resetseed()
profitsincelastcycle = 0
win=true

function dobet()

profitsincelastcycle = lastBet.Profit

   if win then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   if not win then
      nextbet=previousbet*multiplier
   end

end
end
end

Edit Again:  What about this below... But again, it doesn't do martingale correctly.  what am I doing wrong?

this uses "elseif" statements which seemed to work for me in some other applications in the past... of course, I really can't claim to fully understand it.

Code:
chance=49.5
multiplier=2
base=0.00001000
function resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle = lastBet.Profit

   if lastBet == win then
      nextbet=base
      elseif
      not win then nextbet=previousbet*multiplier
      elseif
      profitsincelastcycle == 0.00004000 then
        sleep(300000)
        profitsincelastcycle = 0
      end
end
end

This does martingale but I don't think the sleep part is doing anything:

Code:
chance=49.5
multiplier=2
base=0.00001000
function resetseed()
profitsincelastcycle = 0

function dobet()
if win then
nextbet=base
else
nextbet=previousbet*multiplier
end
local profitsincelastcycle = lastBet.Profit
if     profitsincelastcycle == 0.00001000 then
        sleep(300000)
        profitsincelastcycle = 0
end
end
end
legendary
Activity: 1007
Merit: 1000

Isn't this info already in the bot.seuntjie.com website?  I thought discussion might be more productive.  Do you actually know how to make a good pause/rest/wait function into this bot or were you just teasing me?

Why would you want to pause/rest/wait at all? The time of the bet has no influence on the result of a roll? I really don't see a point to using something like this

but since you're asking for it, you can just use sleep(milliseconds:int)

Awesome, thank you.  Well, the rationale is that I think the timing of the bets actually is important so I'd like to test my ideas and I'd like as much flexibility as possible to test every idea I might have until one of them actually works.  I'm a little dismayed at such doubt and would just like the freedom to explore different ideas even if they are known failures it could generate a better idea later.  I hope folks can understand this.

So this "sleep(milliseconds:int)"  Since I suck at syntax and tried/failed as soon as I saw it posted... can you elaborate on how this would actually work in a script?  For example, my intent was to stop every 10K satoshi profit for "sleep(300000)" or 'five minutes' but my code looked like this and when I ran the simulator I didn't notice any pause.  Will I notice a set 5 minute pause in the simulator?

also, I want to send a resetseed every 5 bets (I know... I know... it won't reset every 5 seeds... please enough with the Questions...)

Can you tell me how to fix this code below?  Actually, can anyone answer my original question, "How do you make it pause after a certain level of profit and then make it start backup automatically after the pause and restart the profit counter?"

Here is the code I tried:

Code:
chance=49.5
multiplier=2
base=0.00001000
resetseed=5
function dobet()
 if win & profitsincelastcycle == 0.00004000 then
  sleep(300000)
  else
  nextbet=base
  end
 if not win then
  nextbet=previousbet*multiplier
  end
 end

Lua is a fickle language.  Your problem is not with the sleep.  resetseed is a function.  Your treating it as a variable.  If you really want to reset the seed just code resetseed()  It doesn't take a parm.   I think there was a discussion about passing in the client seed at some point but not yet. 

also profitsincelastcycle is an undefined variable.  Lua throws up on those too.

Try this
Code:

chance=49.5
multiplier=2
base=0.00001000
resetseed()
profitsincelastcycle = 0

function dobet()

profitsincelastcycle += lastBet.Profit

   if (win) then
      if (profitsincelastcycle == 0.00004000) then
        sleep(300000)
        profitsincelastcycle = 0
      else
        nextbet=base
      end
   if (!win) then
      nextbet=previousbet*multiplier
   end

end

 
   The only thing missing in the above code is what to set nextbet to when you hit your profit cycle.  Currently it will just end up being whatever it's set to. 

And I made the mistake of doing the sleep(30000) and running the simulator.  It hung for 30 seconds each time it hit that.  Basically hung up the bot.  So thats not a true sleep.  More a loop for that many seconds.   
legendary
Activity: 2296
Merit: 1031

Isn't this info already in the bot.seuntjie.com website?  I thought discussion might be more productive.  Do you actually know how to make a good pause/rest/wait function into this bot or were you just teasing me?

Why would you want to pause/rest/wait at all? The time of the bet has no influence on the result of a roll? I really don't see a point to using something like this

but since you're asking for it, you can just use sleep(milliseconds:int)

Awesome, thank you.  Well, the rationale is that I think the timing of the bets actually is important so I'd like to test my ideas and I'd like as much flexibility as possible to test every idea I might have until one of them actually works.  I'm a little dismayed at such doubt and would just like the freedom to explore different ideas even if they are known failures it could generate a better idea later.  I hope folks can understand this.

So this "sleep(milliseconds:int)"  Since I suck at syntax and tried/failed as soon as I saw it posted... can you elaborate on how this would actually work in a script?  For example, my intent was to stop every 10K satoshi profit for "sleep(300000)" or 'five minutes' but my code looked like this and when I ran the simulator I didn't notice any pause.  Will I notice a set 5 minute pause in the simulator?

also, I want to send a resetseed every 5 bets (I know... I know... it won't reset every 5 seeds... please enough with the Questions...)

Can you tell me how to fix this code below?  Actually, can anyone answer my original question, "How do you make it pause after a certain level of profit and then make it start backup automatically after the pause and restart the profit counter?"

Here is the code I tried:

Code:
chance=49.5
multiplier=2
base=0.00001000
resetseed=5
function dobet()
 if win & profitsincelastcycle == 0.00004000 then
  sleep(300000)
  else
  nextbet=base
  end
 if not win then
  nextbet=previousbet*multiplier
  end
 end
legendary
Activity: 1717
Merit: 1125

Isn't this info already in the bot.seuntjie.com website?  I thought discussion might be more productive.  Do you actually know how to make a good pause/rest/wait function into this bot or were you just teasing me?

Why would you want to pause/rest/wait at all? The time of the bet has no influence on the result of a roll? I really don't see a point to using something like this

but since you're asking for it, you can just use sleep(milliseconds:int)
legendary
Activity: 1007
Merit: 1000

     We can start by using the basic Martingale script from the reference site.

chance=49.5
multiplier=2
base=0.00000010
Quote
function dobet()
   if win then
      nextbet=base
   else
      nextbet=previousbet*multiplier
   end
end
   The 3 statements before the function statement will be executed BEFORE the first bet is made.  

chance is a variable that will be used by the bot.  
multiplier and base are internal variables just used by the script.  

    After each bet is placed function dobet is called.  

   In this case, if the bet won, the variable win will be true and the script will reset the nextbet variable to the base bet.  nextbet is a variable used by the bot when placing a bet.
   If the win variable is false, then we lost the bet.  The script will execute the else path.  This will set nextbet equal to the previous bet (previousbet) times multipler.  In this case X 2.  

   The structure LUA uses for if/then/else requires an end statement.  And the function requires an end statement.

A few things I would add to the initialization section.  I would set nextbet = base so the first bet is base on my script not what is filled in the bot's panels.
Also set bethigh  Make it true if you want to go high, false if you want to bet low.  It's as easy as bethigh = false    

So my really basic script would be.
Quote
chance=49.5
multiplier=2
base=0.00000010
nextbet = base  
bethigh = false

function dobet()
   if win then
      nextbet=base
   else
      nextbet=previousbet*multiplier
   end
end

To execute this script, in the programmer mode section click on the console tab at the top.  This opens the LUA console.  The upper section is the output and the lower section is for input.  In the lower section you would type start() to start your script.  And stop() to stop it.  

   You can also use the built in simulator to see how your script will run.  Either from the built in simulator panel (click view, then simulate) ir by typing runsim (X,Y) into the console.  
X is your pretend starting balance
Y is the number of bets to place.  

Note:  Don't start your bot with a large balance.  A small error could cause you to lose everything.  Always start with a small amount just to test out all of your functions.  Of course use the simulator to flush out as much as you can.    

Isn't this info already in the bot.seuntjie.com website?  I thought discussion might be more productive.  Do you actually know how to make a good pause/rest/wait function into this bot or were you just teasing me?

   I'm going to continue to try and explain this for some of the folks that have limited programming experience.     Discussion is always welcome. 

No, I don't know how to do that.   http://mushclient.com/forum/?id=4956  This might help.   

Can you explain what your trying to accomplish by pausing the script?  Maybe there is another way to do what your trying to do. 
legendary
Activity: 1007
Merit: 1000

     We can start by using the basic Martingale script from the reference site.

chance=49.5
multiplier=2
base=0.00000010
Quote
function dobet()
   if win then
      nextbet=base
   else
      nextbet=previousbet*multiplier
   end
end
   The 3 statements before the function statement will be executed BEFORE the first bet is made.  

chance is a variable that will be used by the bot.  
multiplier and base are internal variables just used by the script.  

    After each bet is placed function dobet is called.  

   In this case, if the bet won, the variable win will be true and the script will reset the nextbet variable to the base bet.  nextbet is a variable used by the bot when placing a bet.
   If the win variable is false, then we lost the bet.  The script will execute the else path.  This will set nextbet equal to the previous bet (previousbet) times multipler.  In this case X 2.  

   The structure LUA uses for if/then/else requires an end statement.  And the function requires an end statement.

A few things I would add to the initialization section.  I would set nextbet = base so the first bet is base on my script not what is filled in the bot's panels.
Also set bethigh  Make it true if you want to go high, false if you want to bet low.  It's as easy as bethigh = false    

So my really basic script would be.
Quote
chance=49.5
multiplier=2
base=0.00000010
nextbet = base  
bethigh = false

function dobet()
   if win then
      nextbet=base
   else
      nextbet=previousbet*multiplier
   end
end

To execute this script, in the programmer mode section click on the console tab at the top.  This opens the LUA console.  The upper section is the output and the lower section is for input.  In the lower section you would type start() to start your script.  And stop() to stop it.  

   You can also use the built in simulator to see how your script will run.  Either from the built in simulator panel (click view, then simulate) ir by typing runsim (X,Y) into the console.  
X is your pretend starting balance
Y is the number of bets to place.  

Note:  Don't start your bot with a large balance.  A small error could cause you to lose everything.  Always start with a small amount just to test out all of your functions.  Of course use the simulator to flush out as much as you can.    
legendary
Activity: 2296
Merit: 1031
How do you make it pause after a certain level of profit and then make it start backup automatically after the pause and restart the profit counter?

    That's way more involved then it should be.  Ie. there is no built in way to pause a Lua script.  There is a somewhat involved solution here. http://mushclient.com/forum/?id=4956

   But I have not tried it.  

Is there a reason you NEED to pause the script.
   No wrong answer because I've had a few times where it would have come in handy.  But for the most part I haven't needed it.  

I've only tested things on JD and PRC.  And A quirk of this, once you run out of coin to bet, the bot automatically pauses.  

Now that I'm thinking a little, Do you want to pause to invest, tip or withdraw profit?  

I've tried them all on JD, and tip /withdraw on PRC.  They all work well.  

I was planning on covering this at a later time.  I use invest on JD to take profit from the bot, and setup a second user on PRC and send them tips to take profit.  

One thing to note..   Invest/ tip/ withdraw do not update your balance.  So if your using the balance to calculate your bets, you need to remember what you took out, and adjust accordingly.  

Well, thanks.  I've ran other LUA and XML scripts and script combinations before that could use rest or pause functions.  I just don't know how to incorporate it here.  Also, the current script examples at the referenced website doesn't even do martingale correctly as far as I can tell it just makes the same bet over and over.

edit: nevermind, did some Google searches and figured it out. 
legendary
Activity: 1007
Merit: 1000
How do you make it pause after a certain level of profit and then make it start backup automatically after the pause and restart the profit counter?

    That's way more involved then it should be.  Ie. there is no built in way to pause a Lua script.  There is a somewhat involved solution here. http://mushclient.com/forum/?id=4956

   But I have not tried it. 

Is there a reason you NEED to pause the script.
   No wrong answer because I've had a few times where it would have come in handy.  But for the most part I haven't needed it. 

I've only tested things on JD and PRC.  And A quirk of this, once you run out of coin to bet, the bot automatically pauses. 

Now that I'm thinking a little, Do you want to pause to invest, tip or withdraw profit? 

I've tried them all on JD, and tip /withdraw on PRC.  They all work well. 

I was planning on covering this at a later time.  I use invest on JD to take profit from the bot, and setup a second user on PRC and send them tips to take profit. 

One thing to note..   Invest/ tip/ withdraw do not update your balance.  So if your using the balance to calculate your bets, you need to remember what you took out, and adjust accordingly.   
legendary
Activity: 2296
Merit: 1031
How do you make it pause after a certain level of profit and then make it start backup automatically after the pause and restart the profit counter?
legendary
Activity: 1007
Merit: 1000
    This is a follow on to https://bitcointalksearch.org/topic/seuntjies-dicebot-multi-site-multi-strategy-betting-bot-for-dice-with-charts-307425  

This is the place to discuss the programmer mode of Seuntjie's dice bot.  Also discuss the Lua language as it applies there.  

resources : http://bot.seuntjie.com/ProgrammerMode.aspx

Anything I explain here is related to the V3 B12 version of the bot.  You can get the latest version of Seuntjies Dicebot  here http://bot.seuntjie.com/botpage.aspx

To get into programmer mode click on the Settings Mode and then click on programmer



  You will see 2 panels open on the right side.  The upper panel is a reference panel of available variables, and functions.  These are only the things specific to
the bot, and not everything available.   Also you will find the open and save buttons.  A nice addition that allows you to save your programs and reload them.



  The lower panel is where your code is going to go.  It starts out prefilled with

function dobet()

end

   This is really nice since it's a major part of any program.    This is defining the function dobet.  When you start() the program this function will be called after placing each bet.  

  As time permits I will be cleaning up this post, and adding additional posts to it to explain some of the neat features that you can use with this bot.  
Pages:
Jump to: