Tom's RSS Pro for BetVoyager: Tutorial 2 (From Start to finish)
We will be creating the bot from start to finish.
So first we will start with the two main scripts that Silver sent me.
thomasgrant_multi_alert
and
toms_utils
Both have been modified and made smaller for this exercise.
So those are the two scripts we will be using.
Now to create the interface that will use these scripts.
We want to make it look good.
And work well.
So lets go and design the interface.
(You can find out more about designing the interface at this link.)
link:://rouletteforum.cc/coding-for-roulette/tom%27s-rss-pro-tutorial-v4-%28design%29-in-depth/ (link:://rouletteforum.cc/coding-for-roulette/tom%27s-rss-pro-tutorial-v4-%28design%29-in-depth/)
[attach=2]
Now move all the scripts to the folder.
Once that is done.
You can start up RSS Pro fro BetVoyager.
And we can start to create the interface.
[attachimg=3]
Everything starts with the form.
Read the design tutorial for more info.
link:://rouletteforum.cc/coding-for-roulette/tom%27s-rss-pro-tutorial-v4-%28design%29-in-depth/ (link:://rouletteforum.cc/coding-for-roulette/tom%27s-rss-pro-tutorial-v4-%28design%29-in-depth/)
[attachimg=4]
Picture form2 is nearly done.
Now we change the size.
Change the font for the form to bold.
This will affect all the text on the form.
Change the width and height.
And we are done with the basic dimensions of the form.
So font style is bold.
Height is 364
Width is 522
Here is he finished basic window.
[attachimg=5]
Now to add in some objects that we will use.
1 bevel
3 memos.
2 buttons.
2 edit fields.
2 labels.
[attachimg=1]
Bevel.
[attachimg=2]
Memos.
[attachimg=3]
Buttons.
[attachimg=4]
Edit fields
[attachimg=5]
Labels
[attachimg=6]
Once you have made the interface.
Save your work.
Then rename the objects.
As we will be using them later on.
Renaming object is very handy.
For instance.
Instead of having memo1,memo2,memo3.
We name each one.
memo_RN, (For Red Numbers)
memo_BN, (For Black Numbers)
memo_Res, (For the results.)
The buttons and fields we also change there names.
Button_Start
Button_Stop
And we also do the fields.
Edit_Balance
Edit_Target
Edit_StopLoss
No need to worry about changing the names for labels. Or the bevel.
memo_Res, (For the results.)
Has a scroll bar on the right.
So you can scroll down when text is written to the memo.
Also I have made all the memos Read Only.
I have put here the basic interface in a zip file.
And here is the finished window.
[attachimg=2]
Now that was easy...
Wasn't it...
Now for the code.
Lets get this puppy working.
First make a folder in your main c: called rss-data
c:\rss-data
This is where we will store information.
The first bit of code we will do is to load and save the window position.
This will load the widow in the last position you closed it in.
First thing we need is some variable to do this.
{###### Variables ###########}
{File Variables}
var F : Text;
S : String;
var i;
{###### End: Variables ######}
And then the two procedures that will do the job.
{#### Window Operations ##############################################}
procedure close_me;
begin
if Self.Top<0 then Self.Top:=0;
if Self.Left<0 then Self.Left:=0;
AssignFile(F,'c:\rss-data\bv_winpos');
Rewrite(F);
Writeln(F,Self.Top);
Writeln(F,Self.Left);
CloseFile(F);
end;
procedure load_winpos;
begin
AssignFile(F,'c:\rss-data\bv_winpos');{If no file exist. Then you will get an error message}
Reset(F);{open the file for reading}
I := 0;
while not eof(F) do {loop that will repeat until the end of file will be not found}
begin
S:=ReadLn(F); {read the first line into "s" variable}
if i=0 then Self.Top:=s;
if i=1 then Self.Left:=s;
I := i+1;
end;
CloseFile(F);//close the file
end;
{#### End: Window Operations #########################################}
Fairly simple code.
So lets see if I can explain it to you.
procedure close_me;
This procedure will write the current window position to a file.
This is where it writes the window position to.
AssignFile(F,'c:\rss-data\bv_winpos');
The file name is 'bv_winpos'
procedure load_winpos;
Does the exact opposite.
It loads the saved window position.
So when you run the program.
It will load up in the last saved position.
Now to activate these procedures.
Lets do
procedure close_me;
First.
Take a look at the picture close.
[attachimg=1]
procedure Form2Close(Sender: TObject; var Action: TCloseAction);
begin
close_me;
end;
So you just add in the procedure
close_me;
And save.
Then run the program.
Move the window to somewhere else on the screen.
Close the window.
Now to add in the
procedure load_winpos;
This will open the window in the last saved position.
Take a look at the 'load' picture.
[attachimg=2]
procedure Form2Activate(Sender: TObject);
begin
load_winpos;
end;
Now, whenever you run the script.
The window will start in the last saved position you closed it in.
Not that hard was it?
Fairly straight forward script so far.
Next...
Adding in Silvers scripts into the fray...
Before I get into adding in Silvers scripts.
Here is a video on the first part.
Part one of the video at any rate.
RSS Pro for BetVoyager Video 1. (link:://:.youtube.com/watch?v=zVnsEX-_dnI#)
Next video will be on adding in the objects to the window.
Here is part two of the video.
Adding in objects.
RSS Pro for BetVoyager Video 2. (link:://:.youtube.com/watch?v=GWFrJE8qAH0#)
So, as you can see.
It is fairly easy to create and design an application using RSS Pro.
The hardest part to any application is the code.
Writing code to get it to do what you want it to do.
Silver, from MMM (Money Making Machine)
Is an excellent pascal coder.
And we will be using his scripts to run the application.
I have modified the scripts, made them smaller for this tutorial.
Note: I don't fully understand how the scripts work.
All I do know... Is that they work very well.
So the first parts of the script to add in is toms_utils
But before we add them in.
We make two procedure that will be used in the script.
{#### Memo Operations ################################################}
procedure marque(arg1,arg2);
begin
Memo_BN.Lines.Insert(0,arg1);
Memo_RN.Lines.Insert(0,arg2);
end;
procedure print_to_memo(arg1);
begin
Memo_Res.Lines.Add(arg1);
end;
{#### End: Memo Operations ###########################################}
The first procedure will add in numbers from the casino.
The second will print out results to the Memo_Res.
Adding in toms_utils
{#### toms_utils #####################################################}
procedure bet_x_on_y(xunits,yelements,chips);
{Author Silver; created in february 2009}
var k,x,y,x_knt;
begin
//in your script chips must be declared like this
//chips:=[0,0.01,0.1,0.5,1,10,25,100];
xunits:=xunits*100;
for k:=7 downto 1 do
begin //here we go through every chip
if xunits>=(chips[k]*100) then
begin
x_knt:=((xunits) div (chips[k]*100));//here we check how much chips[k] we must put
for x:=1 to x_knt do
begin
case k of
1:click_chip1();
2:click_chip2();
3:click_chip3();
4:click_chip4();
5:click_chip5();
6:click_chip6();
7:click_chip7();
end;
for y:=0 to VarArrayHighBound(yelements,1) do
begin
case yelements[y] of
{Even Chances}
'Red':click_red();
'Black':click_black();
'High':click_high();
'Low':click_low();
'Odd':click_odd();
'Even':click_even();
//here you can add other elements
end;
end;
xunits:=xunits-(chips[k]*100);//here we reduce the xunits with the value of beted chips
//ShowMessage('We bet chip '+FormatFloat('0.##',chips[k])+', remain to put '+FormatFloat('0.##',(xunits/100))+' units.');
end;
end;
end;
end;
function in_array(i_nr,i_array):boolean;
{check if the i_nr value is from the i_array array}
var k;
begin
result:=false;
for k:=0 to VarArrayHighBound(i_array,1) do
begin
if i_nr=i_array[k] then
begin
result:=True;
break;
end;
end;
end;
function number_is(number, name):boolean;
{check if the number is red, black ,etc.}
begin
result:=false;
case name of
{Even Chances}
'Red': if in_array(number,[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36]) then
begin
marque('',number);
result:=True;
end;
'Black':if in_array(number,[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35]) then
begin
marque(number,'');
result:=True;
end;
'Odd': if in_array(number,[1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35]) then result:=True;
'Even': if in_array(number,[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36]) then result:=True;
'Low': if in_array(number,[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]) then result:=True;
'High': if in_array(number,[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]) then result:=True;
end;//end: case name of
end;
{#### End: toms_utils ################################################}
These procedure are used to work out what number goes where.
'Red': if in_array(number,[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36]) then
begin
marque('',number);
result:=True;
end;
'Black':if in_array(number,[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35]) then
begin
marque(number,'');
result:=True;
end;
These two, will put the red numbers in Memo_RN. And the black numbers in the Memo_BN.
Now before we run the application.
And before we add in any more procedures.
We add in more variables.
{###### Variables ###########}
{File Variables}
var F : Text;
S : String;
var i;
{Chips}
var chips;
{Cash amounts variables}
var currency,start_amount,wish_amount,amount,stop_loss;
{Operation Variables}
var last_nr,unit_value,spin_count,fl_stop,was_betting,sim_mode;
{Element Variables}
var k_el,k_el1,el_n,ch_n,el_name;
var elements,elements_played,total_elements;
{###### End: Variables ######}
Now for the "Key element procedures"
These are the heart of the script.
And what make it tick.
The first one is el_init.
This initialises the elements or systems that we will bet on.
procedure el_init(ei_elements; var ei_elements);
begin
for k_el:=0 to VarArrayHighBound(ei_elements,1) do
begin
ei_elements[k_el,8]:=VarArrayHighBound(ei_elements[k_el,4],1)+1;//how much elelemnts we have in this row
ei_elements[k_el,0]:=VarArrayCreate([0,ei_elements[k_el,8]-1],12);
for k_el1:=0 to ei_elements[k_el,8]-1 do ei_elements[k_el,0,k_el1]:=0;//didn_apear
fl_stop:=ei_elements[k_el,1,0];
ei_elements[k_el,1]:=VarArrayCreate([0,ei_elements[k_el,8]-1],12);
for k_el1:=0 to ei_elements[k_el,8]-1 do ei_elements[k_el,1,k_el1]:=fl_stop;//alerts
ei_elements[k_el,2]:=VarArrayCreate([0,ei_elements[k_el,8]-1],12);
for k_el1:=0 to ei_elements[k_el,8]-1 do ei_elements[k_el,2,k_el1]:=0;//cnt_progression
fl_stop:=ei_elements[k_el,7,0]; ei_elements[k_el,7]:=VarArrayCreate([0,ei_elements[k_el,8]-1],12);
for k_el1:=0 to ei_elements[k_el,8]-1 do ei_elements[k_el,7,k_el1]:=fl_stop;//play_cnt
total_elements:=total_elements+ei_elements[k_el,8];
end;
end;
The second one is el_bet.
This is where the betting on the roulette table will be calculated.
procedure el_bet(eb_elements; var eb_elements);
begin
for k_el:=0 to VarArrayHighBound(eb_elements,1) do begin
for k_el1:=0 to eb_elements[k_el,8]-1 do begin
if (eb_elements[k_el,0,k_el1]>=eb_elements[k_el,1,k_el1])and(eb_elements[k_el,7,k_el1]<>0) then begin //here we check if red didn't apear the wished spins and the play_cnt<>0
eb_elements[k_el,2,k_el1]:=eb_elements[k_el,2,k_el1]+1;//if red didn't apear the wished numbers of spin we increase the cnt_progression
if eb_elements[k_el,2,k_el1]=1 then print_to_memo('Start betting on '+eb_elements[k_el,4,k_el1]+'.');
if eb_elements[k_el,2,k_el1]>VarArrayHighBound(eb_elements[k_el,5],1) then begin fl_stop:=1; break; end;; //here we check if we reach the end of progresion and lose, in this case the game stops
if sim_mode<>1 then begin //if it is not the simulation mode
bet_x_on_y(eb_elements[k_el,5,eb_elements[k_el,2,k_el1]],[eb_elements[k_el,4,k_el1]],chips);//here we bet
was_betting:=1;
end;
end;
if eb_elements[k_el,7,k_el1]=0 then elements_played:=elements_played+1;
end;
end;
end;
This bet_x_on_y is in toms_utils section.
bet_x_on_y(eb_elements[k_el,5,eb_elements[k_el,2,k_el1]],[eb_elements[k_el,4,k_el1]],chips);//here we bet
was_betting:=1;
The code will place the correct amount of chip units on the table.
The third one. And the important one.
Is stack_array.
This is where the elements or systems are counted.
When they reach the point that they start to bet.
el_bet comes into play.
procedure stack_array(sa_elements; var sa_elements);
var k, k1;
begin
for k:=0 to VarArrayHighBound(sa_elements,1) do
begin //b1
for k1:=0 to sa_elements[k,8]-1 do
begin //b2
if sa_elements[k,7,k1]=0 then continue;//in case play_cnt=0 we ignore this element
if number_is(last_nr,sa_elements[k,4,k1]) then
begin //b3
sa_elements[k,0,k1]:=0;//in case the red land counter is again 0
if sa_elements[k,2,k1]>=1 then
begin //b4
if sa_elements[k,3]=-1 then
begin //b5 in case we have voisins or orphelins
if sa_elements[k,4,k1]='orphelins' then
begin //b6 in case we have orphelins
if last_nr=1 then
begin//in case we have landed single1
amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*35)-(sa_elements[k,5,sa_elements[k,2,k1]]*4);
end else
begin
if last_nr<>17 then amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*17)-(sa_elements[k,5,sa_elements[k,2,k1]]*4)//in case we have landed split
else amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*17*2)-(sa_elements[k,5,sa_elements[k,2,k1]]*3);//in case we have landed 17 - 2 splits won
end;
end else //b6
begin //b7 in case we have voisins
if in_array(last_nr,[0,2,3]) then
begin
amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*11*2)-(sa_elements[k,5,sa_elements[k,2,k1]]*7);//in case we have landed street*2
end else
begin
if in_array(last_nr,[25,26,28,29]) then amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*8*2)-(sa_elements[k,5,sa_elements[k,2,k1]]*7)//in case we have landed corner*2
else amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*17)-(sa_elements[k,5,sa_elements[k,2,k1]]*8);//in case we have landed some split
end;
end; //b7
end else //b5
amount:=amount+(sa_elements[k,5,sa_elements[k,2,k1]]*(sa_elements[k,3]-(sa_elements[k,6]-1)));//in case the red win we increase the amount
print_to_memo('Spin count - '+IntToStr(spin_count)+'. We have bet $'+FormatFloat('0.##',sa_elements[k,5,sa_elements[k,2,k1]])+' on '+sa_elements[k,4,k1]+' and win.');
if sa_elements[k,7,k1]<>-1 then sa_elements[k,7,k1]:=sa_elements[k,7,k1]-1;//we decrease the play_cnt
end; //b4
sa_elements[k,2,k1]:=0;//in case the red land cnt_progression became 0, so we again wait for red not to apear x times
end else //b3
begin
if sa_elements[k,2,k1]>=1 then
begin
amount:=amount-(sa_elements[k,5,sa_elements[k,2,k1]]*sa_elements[k,6]);//in case the red lose we decrese amount with how much we bet on red
print_to_memo('Spin count - '+IntToSTr(spin_count)+'. We have bet $'+FormatFloat('0.##',sa_elements[k,5,sa_elements[k,2,k1]])+' on '+sa_elements[k,4,k1]+' and lose.');
end;
sa_elements[k,0,k1]:=sa_elements[k,0,k1]+1;//in case the red didn't land counter is increased
end;
end; //b2
end; //b1
end;
Then we have the last one in the elements.
Where we add the systems.
In this one.
I just added in even chance bets.
procedure add_systems;{Note to self: Check the progressions in the elements for each system}
begin
elements:=[
[[0],[5],[0], 1,['Red','Black','High','Low','Odd','Even'],
[0,1,2,4,8,16,32,64,128,256,512],1,[-1],0]
];
end;
Here is an update on the variables.
{###### Variables ###########}
{File Variables}
var F : Text;
S : String;
var i;
{InputQuery variables}
var qr,decision,decide;
{Chips, chip units, min chip settings}
var CU,chips,chips_set,Chip1,Chip2,Chip3,Chip4,Chip5,Chip6,Chip7,min_chip,chip_q;
{Print Variables}
var PT,pn,n,ds,nos;
{Cash amounts variables}
var currency,start_amount,wish_amount,amount,stop_loss;
{Operation Variables}
var last_nr,unit_value,spin_count,fl_stop,was_betting,sim_mode;
{Element Variables}
var k_el,k_el1,el_n,ch_n,el_name;
var elements,elements_played,total_elements;
{###### End: Variables ######}
Now to add in a few more key procedures.
This procedure for setting up arrays that will be used in the script.
procedure setup_arrays;
begin
chips:=[0,0.01,0.1,0.5,1,10,25,100];
end;
This procedure to place a bet on Red and Black for nearly every spin.
Except the spins that have bets on them.
procedure bet_RB;
begin
click_chip1();
click_red();
click_black();
end;
And to set up the script and it's variables.
We put the information in at the start.
procedure Form2Activate(Sender: TObject);
begin
load_winpos;
add_systems;
setup_arrays;
start_amount:=Edit_Balance.Text;
amount:=start_amount;//current amount became start_amount
//wish_amount:=start_amount+Edit_Target.Text;
wish_amount:=StrToFloat(start_amount)+StrToFloat(Edit_Target.Text);
stop_loss:=Edit_StopLoss.Text;
elements_played:=0;
el_init(elements,elements);
spin_count:=1;
was_betting:=1;
fl_stop:=0;
currency:='$';
decision:='y';
unit_value:=1;
end;
Next, we write a procedure that will start playing.
procedure start_playing;
begin
amount:=Edit_Balance.Text;
print_to_memo(FormatFloat('0.##',amount));
wish_amount:=StrToFloat(start_amount)+StrToFloat(Edit_Target.Text);
print_to_memo(FormatFloat('0.##',wish_amount));
while amount<wish_amount do
begin
was_betting:=0;
elements_played:=0;
el_bet(elements,elements);
if was_betting=0 then bet_RB;
if (fl_stop=1)or(elements_played=total_elements) then break;
click_spin_button();
last_nr:=get_last_landed_number();
stack_array(elements,elements);
print_to_memo('Spin count - '+IntToSTr(spin_count)+'. Landed numbrer is '+IntToStr(last_nr)+'. Current amount is $'+FormatFloat('0.##',amount));
print_to_memo('-------------------------------------------');
//if amount<=stop_loss then break;
Inc(spin_count);
end;
end;
That is about it for the main code.
Now it is time to get it to work.
First lets fix up the buttons and fields.
Lets do the fields first.
On keypress
Here are the 3 edit fields.
And the code for them.
procedure Edit_BalanceKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
end;
start_amount:=Edit_Balance.Text;
end;
procedure Edit_TargetKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
end;
wish_amount:=StrToFloat(start_amount)+StrToFloat(Edit_Target.Text);
end;
procedure Edit_StopLossKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
end;
stop_loss:=Edit_StopLoss.Text;
end;
Basically all that code does is on pressing the return key or the enter key.
The start_amount:=Edit_Balance.Text;
Or the start_amount will = the amount that is in the Edit_Balance field.
For the two buttons.
procedure Button_StopClick(Sender: TObject);
begin
fl_stop:=1;
end;
procedure Button_StartClick(Sender: TObject);
begin
fl_stop:=0;
memo_Res.Clear();
start_playing;
end;
Here it all is.
Done and dusted.
Small file with just the source code.
My_RSS_Pro_Bot_for_BV.zip
For those that wish to see the all the videos and pics I did for this.
I have put it all together in one zip file.
link:://:.thomasrgrant.com/stuff/My_RSS_Pro_Bot_for_BV_with_vids.zip (link:://:.thomasrgrant.com/stuff/My_RSS_Pro_Bot_for_BV_with_vids.zip)
Here is the last video in the series.
RSS Pro for BetVoyager Video 3. (link:://:.youtube.com/watch?v=P_3DYlPkrL0#)
Congrats Thomas :) !
Quote from: Twisteruk on Oct 10, 10:28 AM 2010
Congrats Thomas :) !
Thank you...
Only problem I find, is that no one else in this forum has RSS Pro or RSS Pro for BV.
So it's like making a movie no one will ever see.
One of the things that motivates me to do more.
Is interaction or participation.
When I got someone to bounce this code of.
Or share code with.
That sort of thing inspires me.
But as far as I know, only Victor has RSS Pro. And I sent him a copy of it.
Not even sure he has ever used it.
Shame...
Such a nice program to use.