DiceBot Programmer mode tutorial 01 - Overview

in #dicebot8 years ago (edited)

The programmer mode in DiceBot is a powerful extension to the bot that is quite popular among some of the power users of the bot. It's something that quite a few people don't even know exists and a lot of people are too scared to try or have no idea how it works. While a little programming knowledge is required for it, it's really easy and simple to use. In these tutorials I'll assume you have a little bit of programming knowledge, but I'll still cover a few basics anyway.



To start of with, lets take a look at the interface:

There are 2 tabs in the programmer mode. Code and Console.


In the Code Tab, there are 4 parts, namely the variables, functions, controls and code box.

Code Tab

Variables

First up is the variables box. This box lists variables that are already made available in the LUA environment by the bot for use in your calculations. The format of the list is variable name : data type, permissions.


-


Some variables are read only and have RO appended to them in the list. You can assign values to them from the script or console, but it will have no effect on the bet and the variable will be set by the bot again after the next bet.

Variables with RW behind them are not reset by the bot after each bet and can be assigned values that will effect the next bet, for example nextbet, chance or bethigh.


A full list of variables with explinations for each, as well as a short description for what variables are and how to use them, see DiceBot Programmer mode tutorial 1.1 - Variables


These variables can be set from the console if required.

Functions

A box similar to the variables box is available for functions provided by the bot.


-


Most functions are solely to execute a specific task, but some of the functions do return objects. The format the functions are listed is as follows:

functionname(parameter 1 name : parameter 1 type,parameter 2 name : parameter 2 type,.....) : return type if applicable

see DiceBot Programmer mode tutorial 1.2 - Functions for a list of DiceBot functions available to the user in the programmer mode, as well as a short description of what functions are and how to use them.


Buttons

The programmer mode has a few buttons: open, save and help.



Open and save are self explanitory. The help button simply opens the programmer mode info page that can be found here.

Code Box

The code box is where you actually enter your script. The code box is a horrible IDE with no syntax highlighting, indenting, auto complete or frankly anything you'd expect from an IDE. It does come prefilled with a dobet function declared, as this is the function executed by the bot when the value for the next bet is required.



Console Tab

The console has two main parts, input and output. The top, bigger part of the console is the output, with the smaller bottom box serving as input.



Output

The output box shows actions performed by the bot, for example bets placed, tips, withdrawals, seed resets, start and stop actions, as well as any input received from the console input.


The print function available from the functions box will print to this output box.


The output box has a line limit and when this limit is reached, older lines are deleted from the output. This is to save memory space for bots running extended periods of time.


Input

The consoles input box is used to input commands into the programmer mode environment. From this console, the user can call or execute functions, set or declare variables, print variables and most importantly, start and stop the bot. 


The input box has a 20 command history, that can be accessed using the up and down arrow keys. This means the last 20 commands entered into the console input is stored and can be re-executed. Using up or down to navigate to the command you want, and pressing enter. The latest command is always added to the bottom of the list.


To start the bot, you need to execute the start() function form the console. To stop the bot, you can either execute stop() from the console, use the emergency stop keys (ctrl + shift + s) or have a stop condition set in your script that will make the bot stop if certain conditions are met.


See the next tutorial on the format of the actual script and a basic martingale script.

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.029
BTC 66560.03
ETH 3447.91
USDT 1.00
SBD 2.64