Check out the new moneypot app I'm working on!

The new app is unfortunately not yet supported in DiceBot, but will soon be.

Programmer mode

The newly implemented programmer mode in the dice bot allows the user to write a lua script that will be executed by the bot whenever a bet result is received.

Youtube Tutorials

Programmer Mode Tutorials on Steemit

Code tab overview

At the top of the code tab, a list box lists the variables already available in the script, in the form (name):(type), (access level), where RO=Read Only and RW = Read Write.
The read only variables are set by the bot before calling the dobet() function. Even though you can assign them new values, after each bet, they are reset to the values inside the bot. Setting these values in the script will not change anything in the bot's local variables.

The read write variables are set to the values local in the bot before executing the script, and after executing the script, the values are fetched from the script and overwrites those in the bot.

a UML for the Bet class (type of lastBet variable) can be seen at the bottom of the page.

Below the variables, there is a box with available functions to call from inside the script. The functions are pretty self explanetory.

The print function will print the string in the console.

The code/script box is where your lua code is written. the function dobet() is called after the result of each bet. You are welcome to declare and use more functions, but the dobet() HAS to be there. It's like the Main() in other programs.

The help button brings you to this page.

Console Tab overview

The console tab is basically a small lua shell where you can execute lua functions and a few bot functions as well. The big box is only an output box, the box at the bottom is the input box.

Available console commands:
all lua functions and assingments. If you create a function in the code box, it should be available to call from within the console input. (You might need to start and stop the bot or run a small sim for the functions to be available)
start() - start betting. This needs to be called from the console after your code has been written in the code box.
stop() - stop betting.

runsim(double startingBalance, int NumberOfBets) - runs a simulation of the strategy coded in the code box.

all other methods listed in the function/method box on the code tab

Basic overview of script lifecycle

Here's a small overview of the lifecycle of the script, how and in which order everything is executed

1) bot starup - loads basic functions (withdraw, invest, tip, stop, runsim etc)
2) start() or runstim() is executed. the script in the code box is executed once. Thus functions are registered, variables are created and assigned.
3) place starting bet: the bot places the starting bet: no script executed
4) bet result returned: 4.1) variables (balance, profit, wins, lossess etc) are updated.
   4.2) dobet() is executed.
   4.3) local variables are updated to new varibable from the bot (chance, nextbet, high)
5) next bet is placed. On bet result, go back to step 4.

Changes to the script will not take place untill start() is called again.

All assignments and functions called from within the console is executed directly.

bet UML:
betclass uml