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.1,1,5,10,25,100,500];
  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
            'red':click_red();
            'black':click_black();
            'high':click_high();
            'low':click_low();
            'odd':click_odd();
            'even':click_even();
            'dozen1':click_first_dozen_bet();
            'dozen2':click_second_dozen_bet();
            'dozen3':click_third_dozen_bet();
            'column1':click_first_column_bet();
            'column2':click_second_column_bet();
            'column3':click_third_column_bet();
            'line1':click_line_bet_1_2_3_4_5_6();
            'line2':click_line_bet_4_5_6_7_8_9();
            'line3':click_line_bet_7_8_9_10_11_12();
            'line4':click_line_bet_10_11_12_13_14_15();
            'line5':click_line_bet_13_14_15_16_17_18();
            'line6':click_line_bet_16_17_18_19_20_21();
            'line7':click_line_bet_19_20_21_22_23_24();
            'line8':click_line_bet_22_23_24_25_26_27();
            'line9':click_line_bet_25_26_27_28_29_30();
            'line10':click_line_bet_28_29_30_31_32_33();
            'line11':click_line_bet_31_32_33_34_35_36();
            'street012':click_street_bet_0_1_2();
            'street023':click_street_bet_0_2_3();
            'street1':click_street_bet_1_2_3();
            'street2':click_street_bet_4_5_6();
            'street3':click_street_bet_7_8_9();
            'street4':click_street_bet_10_11_12();
            'street5':click_street_bet_13_14_15();
            'street6':click_street_bet_16_17_18();
            'street7':click_street_bet_19_20_21();
            'street8':click_street_bet_22_23_24();
            'street9':click_street_bet_25_26_27();
            'street10':click_street_bet_28_29_30();
            'street11':click_street_bet_31_32_33();
            'street12':click_street_bet_34_35_36();
            'corner1': click_corner_bet_1_2_4_5();
            'corner2': click_corner_bet_2_3_5_6();
            'corner3': click_corner_bet_4_5_7_8();
            'corner4': click_corner_bet_5_6_8_9();
            'corner5': click_corner_bet_7_8_10_11();
            'corner6': click_corner_bet_8_9_11_12();
            'corner7': click_corner_bet_10_11_13_14();
            'corner8': click_corner_bet_11_12_14_15();
            'corner9': click_corner_bet_13_14_16_17();
            'corner10': click_corner_bet_14_15_17_18();
            'corner11': click_corner_bet_16_17_19_20();
            'corner12': click_corner_bet_17_18_20_21();
            'corner13': click_corner_bet_19_20_22_23();
            'corner14': click_corner_bet_20_21_23_24();
            'corner15': click_corner_bet_22_23_25_26();
            'corner16': click_corner_bet_23_24_26_27();
            'corner17': click_corner_bet_25_26_28_29();
            'corner18': click_corner_bet_26_27_29_30();
            'corner19': click_corner_bet_28_29_31_32();
            'corner20': click_corner_bet_29_30_32_33();
            'corner21': click_corner_bet_31_32_34_35();
            'corner22': click_corner_bet_32_33_35_36();
            'single0': click_straight_up_0();
            'single1': click_straight_up_1();
            'single2': click_straight_up_2();
            'single3': click_straight_up_3();
            'single4': click_straight_up_4();
            'single5': click_straight_up_5();
            'single6': click_straight_up_6();
            'single7': click_straight_up_7();
            'single8': click_straight_up_8();
            'single9': click_straight_up_9();
            'single10': click_straight_up_10();
            'single11': click_straight_up_11();
            'single12': click_straight_up_12();
            'single13': click_straight_up_13();
            'single14': click_straight_up_14();
            'single15': click_straight_up_15();
            'single16': click_straight_up_16();
            'single17': click_straight_up_17();
            'single18': click_straight_up_18();
            'single19': click_straight_up_19();
            'single20': click_straight_up_20();
            'single21': click_straight_up_21();
            'single22': click_straight_up_22();
            'single23': click_straight_up_23();
            'single24': click_straight_up_24();
            'single25': click_straight_up_25();
            'single26': click_straight_up_26();
            'single27': click_straight_up_27();
            'single28': click_straight_up_28();
            'single29': click_straight_up_29();
            'single30': click_straight_up_30();
            'single31': click_straight_up_31();
            'single32': click_straight_up_32();
            'single33': click_straight_up_33();
            'single34': click_straight_up_34();
            'single35': click_straight_up_35();
            'single36': click_straight_up_36();
            'split0_1': click_split_bet_0_1();
            'split0_2': click_split_bet_0_2();
            'split0_3': click_split_bet_0_3();
            'split1_2': click_split_bet_1_2();
            'split1_4': click_split_bet_1_4();
            'split2_3': click_split_bet_2_3();
            'split2_5': click_split_bet_2_5();
            'split3_6': click_split_bet_3_6();
            'split4_5': click_split_bet_4_5();
            'split4_7': click_split_bet_4_7();
            'split5_6': click_split_bet_5_6();
            'split5_8': click_split_bet_5_8();
            'split6_9': click_split_bet_6_9();
            'split7_8': click_split_bet_7_8();
            'split7_10': click_split_bet_7_10();
            'split8_9': click_split_bet_8_9();
            'split8_11': click_split_bet_8_11();
            'split9_12': click_split_bet_9_12();
            'split10_11': click_split_bet_10_11();
            'split10_13': click_split_bet_10_13();
            'split11_12': click_split_bet_11_12();
            'split11_14': click_split_bet_11_14();
            'split12_15': click_split_bet_12_15();
            'split13_14': click_split_bet_13_14();
            'split13_16': click_split_bet_13_16();
            'split14_15': click_split_bet_14_15();
            'split14_17': click_split_bet_14_17();
            'split15_18': click_split_bet_15_18();
            'split16_17': click_split_bet_16_17();
            'split16_19': click_split_bet_16_19();
            'split17_18': click_split_bet_17_18();
            'split17_20': click_split_bet_17_20();
            'split18_21': click_split_bet_18_21();
            'split19_20': click_split_bet_19_20();
            'split19_22': click_split_bet_19_22();
            'split20_21': click_split_bet_20_21();
            'split20_23': click_split_bet_20_23();
            'split21_24': click_split_bet_21_24();
            'split22_23': click_split_bet_22_23();
            'split22_25': click_split_bet_22_25();
            'split23_24': click_split_bet_23_24();
            'split23_26': click_split_bet_23_26();
            'split24_27': click_split_bet_24_27();
            'split25_26': click_split_bet_25_26();
            'split25_28': click_split_bet_25_28();
            'split26_27': click_split_bet_26_27();
            'split26_29': click_split_bet_26_29();
            'split27_30': click_split_bet_27_30();
            'split28_29': click_split_bet_28_29();
            'split28_31': click_split_bet_28_31();
            'split29_30': click_split_bet_29_30();
            'split29_32': click_split_bet_29_32();
            'split30_33': click_split_bet_30_33();
            'split31_32': click_split_bet_31_32();
            'split31_34': click_split_bet_31_34();
            'split32_33': click_split_bet_32_33();
            'split32_35': click_split_bet_32_35();
            'split33_36': click_split_bet_33_36();
            'split34_35': click_split_bet_34_35();
            'split35_36': click_split_bet_35_36();
            'voisins':begin
                        click_split_bet_4_7();
                        click_split_bet_12_15();
                        click_split_bet_18_21();
                        click_split_bet_19_22();
                        click_split_bet_32_35();
                        click_street_bet_0_2_3();
                        click_street_bet_0_2_3();
                        click_corner_bet_25_26_28_29();
                        click_corner_bet_25_26_28_29();
                      end;
            'tier':begin
                     click_split_bet_7_8();
                     click_split_bet_10_11();
                     click_split_bet_13_16();
                     click_split_bet_23_24();
                     click_split_bet_27_30();
                     click_split_bet_33_36();
                   end;
            'orphelins':begin
                          click_straight_up_1();
                          click_split_bet_6_9();
                          click_split_bet_14_17();
                          click_split_bet_17_20();
                          click_split_bet_31_34();
                        end;
            'neighbors0':begin
                           click_straight_up_0();
                           click_straight_up_3();click_straight_up_26();
                           click_straight_up_32();click_straight_up_15();
                         end;
            'neighbors32':begin
                            click_straight_up_32();
                            click_straight_up_26();click_straight_up_0();
                            click_straight_up_15();click_straight_up_19();
                          end;
            'neighbors15':begin
                            click_straight_up_15();
                            click_straight_up_0();click_straight_up_32();
                            click_straight_up_19();click_straight_up_4();
                          end;
            'neighbors19':begin
                            click_straight_up_19();
                            click_straight_up_32();click_straight_up_15();
                            click_straight_up_4();click_straight_up_21();
                          end;
            'neighbors4':begin
                            click_straight_up_4();
                            click_straight_up_15();click_straight_up_19();
                            click_straight_up_21();click_straight_up_2();
                          end;
            'neighbors21':begin
                            click_straight_up_21();
                            click_straight_up_19();click_straight_up_4();
                            click_straight_up_2();click_straight_up_25();
                          end;
            'neighbors2':begin
                            click_straight_up_2();
                            click_straight_up_4();click_straight_up_21();
                            click_straight_up_25();click_straight_up_17();
                          end;
            'neighbors25':begin
                            click_straight_up_25();
                            click_straight_up_21();click_straight_up_2();
                            click_straight_up_17();click_straight_up_34();
                          end;
            'neighbors17':begin
                            click_straight_up_17();
                            click_straight_up_2();click_straight_up_25();
                            click_straight_up_34();click_straight_up_6();
                          end;
            'neighbors34':begin
                            click_straight_up_34();
                            click_straight_up_25();click_straight_up_17();
                            click_straight_up_6();click_straight_up_27();
                          end;
            'neighbors6':begin
                            click_straight_up_6();
                            click_straight_up_17();click_straight_up_34();
                            click_straight_up_27();click_straight_up_13();
                          end;
            'neighbors27':begin
                            click_straight_up_27();
                            click_straight_up_34();click_straight_up_6();
                            click_straight_up_13();click_straight_up_36();
                          end;
            'neighbors13':begin
                            click_straight_up_13();
                            click_straight_up_6();click_straight_up_27();
                            click_straight_up_36();click_straight_up_11();
                          end;
            'neighbors36':begin
                            click_straight_up_36();
                            click_straight_up_27();click_straight_up_13();
                            click_straight_up_11();click_straight_up_30();
                          end;
            'neighbors11':begin
                            click_straight_up_11();
                            click_straight_up_13();click_straight_up_36();
                            click_straight_up_30();click_straight_up_8();
                          end;
            'neighbors30':begin
                            click_straight_up_30();
                            click_straight_up_36();click_straight_up_11();
                            click_straight_up_8();click_straight_up_23();
                          end;
            'neighbors8':begin
                            click_straight_up_8();
                            click_straight_up_11();click_straight_up_30();
                            click_straight_up_23();click_straight_up_10();
                          end;
            'neighbors23':begin
                            click_straight_up_23();
                            click_straight_up_30();click_straight_up_8();
                            click_straight_up_10();click_straight_up_5();
                          end;
            'neighbors10':begin
                            click_straight_up_10();
                            click_straight_up_8();click_straight_up_23();
                            click_straight_up_5();click_straight_up_24();
                          end;
            'neighbors5':begin
                            click_straight_up_5();
                            click_straight_up_23();click_straight_up_10();
                            click_straight_up_24();click_straight_up_16();
                          end;
            'neighbors24':begin
                            click_straight_up_24();
                            click_straight_up_10();click_straight_up_5();
                            click_straight_up_16();click_straight_up_33();
                          end;
            'neighbors16':begin
                            click_straight_up_16();
                            click_straight_up_5();click_straight_up_24();
                            click_straight_up_33();click_straight_up_1();
                          end;
            'neighbors33':begin
                            click_straight_up_33();
                            click_straight_up_24();click_straight_up_16();
                            click_straight_up_1();click_straight_up_20();
                          end;
            'neighbors1':begin
                            click_straight_up_1();
                            click_straight_up_16();click_straight_up_33();
                            click_straight_up_20();click_straight_up_14();
                          end;
            'neighbors20':begin
                            click_straight_up_20();
                            click_straight_up_33();click_straight_up_1();
                            click_straight_up_14();click_straight_up_31();
                          end;
            'neighbors14':begin
                            click_straight_up_14();
                            click_straight_up_1();click_straight_up_20();
                            click_straight_up_31();click_straight_up_9();
                          end;
            'neighbors31':begin
                            click_straight_up_31();
                            click_straight_up_20();click_straight_up_14();
                            click_straight_up_9();click_straight_up_22();
                          end;
            'neighbors9':begin
                            click_straight_up_9();
                            click_straight_up_14();click_straight_up_31();
                            click_straight_up_22();click_straight_up_18();
                          end;
            'neighbors22':begin
                            click_straight_up_22();
                            click_straight_up_31();click_straight_up_9();
                            click_straight_up_18();click_straight_up_29();
                          end;
            'neighbors18':begin
                            click_straight_up_18();
                            click_straight_up_9();click_straight_up_22();
                            click_straight_up_29();click_straight_up_7();
                          end;
            'neighbors29':begin
                            click_straight_up_29();
                            click_straight_up_22();click_straight_up_18();
                            click_straight_up_7();click_straight_up_28();
                          end;
            'neighbors7':begin
                            click_straight_up_7();
                            click_straight_up_18();click_straight_up_29();
                            click_straight_up_28();click_straight_up_12();
                          end;
            'neighbors28':begin
                            click_straight_up_28();
                            click_straight_up_29();click_straight_up_7();
                            click_straight_up_12();click_straight_up_35();
                          end;
            'neighbors12':begin
                            click_straight_up_12();
                            click_straight_up_7();click_straight_up_28();
                            click_straight_up_35();click_straight_up_3();
                          end;
            'neighbors35':begin
                            click_straight_up_35();
                            click_straight_up_28();click_straight_up_12();
                            click_straight_up_3();click_straight_up_26();
                          end;
            'neighbors3':begin
                            click_straight_up_3();
                            click_straight_up_12();click_straight_up_35();
                            click_straight_up_26();click_straight_up_0();
                          end;
            'neighbors26':begin
                            click_straight_up_26();
                            click_straight_up_35();click_straight_up_3();
                            click_straight_up_0();click_straight_up_32();
                          end;
            'finalbet0':begin
                          click_straight_up_0();click_straight_up_10();
                          click_straight_up_20();click_straight_up_30();
                        end;
            'finalbet1':begin
                          click_straight_up_1();click_straight_up_11();
                          click_straight_up_21();click_straight_up_31();
                        end;
            'finalbet2':begin
                          click_straight_up_2();click_straight_up_12();
                          click_straight_up_22();click_straight_up_32();
                        end;
            'finalbet3':begin
                          click_straight_up_3();click_straight_up_13();
                          click_straight_up_23();click_straight_up_33();
                        end;
            'finalbet4':begin
                          click_straight_up_4();click_straight_up_14();
                          click_straight_up_24();click_straight_up_34();
                        end;
            'finalbet5':begin
                          click_straight_up_5();click_straight_up_15();
                          click_straight_up_25();click_straight_up_35();
                        end;
            'finalbet6':begin
                          click_straight_up_6();click_straight_up_16();
                          click_straight_up_26();click_straight_up_36();
                        end;
            'finalbet7':begin
                          click_straight_up_7();click_straight_up_17();
                          click_straight_up_27();
                        end;
            'finalbet8':begin
                          click_straight_up_8();click_straight_up_18();
                          click_straight_up_28();
                        end;
            'finalbet9':begin
                          click_straight_up_9();click_straight_up_19();
                          click_straight_up_29();
                        end;
            'line1_3':begin
                        click_line_bet_1_2_3_4_5_6();
                        click_line_bet_7_8_9_10_11_12();
                      end;
            'line1_4':begin
                        click_line_bet_1_2_3_4_5_6();
                        click_line_bet_10_11_12_13_14_15();
                      end;
            'street1_3':begin
                        click_street_bet_1_2_3();
                        click_street_bet_7_8_9();
                      end;
            'street1_4':begin
                        click_street_bet_1_2_3();
                        click_street_bet_10_11_12();
                      end;
          //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
   'red':  if in_array(number,[1,3,5,7, 9,12,14,16,18,19,21,23,25,27,30,32,34,36]) then result:=True;
   'black':if in_array(number,[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35]) then result:=True;
   '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;
   'dozen1':if in_array(number,[ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12]) then result:=True;
   'dozen2':if in_array(number,[13,14,15,16,17,18,19,20,21,22,23,24]) then result:=True;
   'dozen3':if in_array(number,[25,26,27,28,29,30,31,32,33,34,35,36]) then result:=True;
   'column1':if in_array(number,[1,4,7,10,13,16,19,22,25,28,31,34]) then result:=True;
   'column2':if in_array(number,[2,5,8,11,14,17,20,23,26,29,32,35]) then result:=True;
   'column3':if in_array(number,[3,6,9,12,15,18,21,24,27,30,33,36]) then result:=True;
   'line1': if in_array(number,[ 1, 2, 3, 4, 5, 6]) then result:=True;
   'line2': if in_array(number,[ 4, 5, 6, 7, 8, 9]) then result:=True;
   'line3': if in_array(number,[ 7, 8, 9,10,11,12]) then result:=True;
   'line4': if in_array(number,[10,11,12,13,14,15]) then result:=True;
   'line5': if in_array(number,[13,14,15,16,17,18]) then result:=True;
   'line6': if in_array(number,[16,17,18,19,20,21]) then result:=True;
   'line7': if in_array(number,[19,20,21,22,23,24]) then result:=True;
   'line8': if in_array(number,[22,23,24,25,26,27]) then result:=True;
   'line9': if in_array(number,[25,26,27,28,29,30]) then result:=True;
   'line10':if in_array(number,[28,29,30,31,32,33]) then result:=True;
   'line11':if in_array(number,[31,32,33,34,35,36]) then result:=True;
   'street012':if in_array(number,[ 0, 1, 2]) then result:=True;
   'street023':if in_array(number,[ 0, 2, 3]) then result:=True;
   'street1':  if in_array(number,[ 1, 2, 3]) then result:=True;
   'street2':  if in_array(number,[ 4, 5, 6]) then result:=True;
   'street3':  if in_array(number,[ 7, 8, 9]) then result:=True;
   'street4':  if in_array(number,[10,11,12]) then result:=True;
   'street5':  if in_array(number,[13,14,15]) then result:=True;
   'street6':  if in_array(number,[16,17,18]) then result:=True;
   'street7':  if in_array(number,[19,20,21]) then result:=True;
   'street8':  if in_array(number,[22,23,24]) then result:=True;
   'street9':  if in_array(number,[25,26,27]) then result:=True;
   'street10': if in_array(number,[28,29,30]) then result:=True;
   'street11': if in_array(number,[31,32,33]) then result:=True;
   'street12': if in_array(number,[34,35,36]) then result:=True;
   'corner1':  if in_array(number,[ 1, 2, 4, 5]) then result:=True;
   'corner2':  if in_array(number,[ 2, 3, 5, 6]) then result:=True;
   'corner3':  if in_array(number,[ 4, 5, 7, 8]) then result:=True;
   'corner4':  if in_array(number,[ 5, 6, 8, 9]) then result:=True;
   'corner5':  if in_array(number,[ 7, 8,10,11]) then result:=True;
   'corner6':  if in_array(number,[ 8, 9,11,12]) then result:=True;
   'corner7':  if in_array(number,[10,11,13,14]) then result:=True;
   'corner8':  if in_array(number,[11,12,14,15]) then result:=True;
   'corner9':  if in_array(number,[13,14,16,17]) then result:=True;
   'corner10': if in_array(number,[14,15,17,18]) then result:=True;
   'corner11': if in_array(number,[16,17,19,20]) then result:=True;
   'corner12': if in_array(number,[17,18,20,21]) then result:=True;
   'corner13': if in_array(number,[19,20,22,23]) then result:=True;
   'corner14': if in_array(number,[20,21,23,24]) then result:=True;
   'corner15': if in_array(number,[22,23,25,26]) then result:=True;
   'corner16': if in_array(number,[23,24,26,27]) then result:=True;
   'corner17': if in_array(number,[25,26,28,29]) then result:=True;
   'corner18': if in_array(number,[26,27,29,30]) then result:=True;
   'corner19': if in_array(number,[28,29,31,32]) then result:=True;
   'corner20': if in_array(number,[29,30,32,33]) then result:=True;
   'corner21': if in_array(number,[31,32,34,35]) then result:=True;
   'corner22': if in_array(number,[32,33,35,36]) then result:=True;
   'split0_1':   if in_array(number,[ 0, 1]) then result:=True;
   'split0_2':   if in_array(number,[ 0, 2]) then result:=True;
   'split0_3':   if in_array(number,[ 0, 3]) then result:=True;
   'split1_2':   if in_array(number,[ 1, 2]) then result:=True;
   'split1_4':   if in_array(number,[ 1, 4]) then result:=True;
   'split2_3':   if in_array(number,[ 2, 3]) then result:=True;
   'split2_5':   if in_array(number,[ 2, 5]) then result:=True;
   'split3_6':   if in_array(number,[ 3, 6]) then result:=True;
   'split4_5':   if in_array(number,[ 4, 5]) then result:=True;
   'split4_7':   if in_array(number,[ 4, 7]) then result:=True;
   'split5_6':   if in_array(number,[ 5, 6]) then result:=True;
   'split5_8':   if in_array(number,[ 5, 8]) then result:=True;
   'split6_9':   if in_array(number,[ 6, 9]) then result:=True;
   'split7_8':   if in_array(number,[ 7, 8]) then result:=True;
   'split7_10':  if in_array(number,[ 7,10]) then result:=True;
   'split8_9':   if in_array(number,[ 8, 9]) then result:=True;
   'split8_11':  if in_array(number,[ 8,11]) then result:=True;
   'split9_12':  if in_array(number,[ 9,12]) then result:=True;
   'split10_11': if in_array(number,[10,11]) then result:=True;
   'split10_13': if in_array(number,[10,13]) then result:=True;
   'split11_12': if in_array(number,[11,12]) then result:=True;
   'split11_14': if in_array(number,[11,14]) then result:=True;
   'split12_15': if in_array(number,[12,15]) then result:=True;
   'split13_14': if in_array(number,[13,14]) then result:=True;
   'split13_16': if in_array(number,[13,16]) then result:=True;
   'split14_15': if in_array(number,[14,15]) then result:=True;
   'split14_17': if in_array(number,[14,17]) then result:=True;
   'split15_18': if in_array(number,[15,18]) then result:=True;
   'split16_17': if in_array(number,[16,17]) then result:=True;
   'split16_19': if in_array(number,[16,19]) then result:=True;
   'split17_18': if in_array(number,[17,18]) then result:=True;
   'split17_20': if in_array(number,[17,20]) then result:=True;
   'split18_21': if in_array(number,[18,21]) then result:=True;
   'split19_20': if in_array(number,[19,20]) then result:=True;
   'split19_22': if in_array(number,[19,22]) then result:=True;
   'split20_21': if in_array(number,[20,21]) then result:=True;
   'split20_23': if in_array(number,[20,23]) then result:=True;
   'split21_24': if in_array(number,[21,24]) then result:=True;
   'split22_23': if in_array(number,[22,23]) then result:=True;
   'split22_25': if in_array(number,[22,25]) then result:=True;
   'split23_24': if in_array(number,[23,24]) then result:=True;
   'split23_26': if in_array(number,[23,26]) then result:=True;
   'split24_27': if in_array(number,[24,27]) then result:=True;
   'split25_26': if in_array(number,[25,26]) then result:=True;
   'split25_28': if in_array(number,[25,28]) then result:=True;
   'split26_27': if in_array(number,[26,27]) then result:=True;
   'split26_29': if in_array(number,[26,29]) then result:=True;
   'split27_30': if in_array(number,[27,30]) then result:=True;
   'split28_29': if in_array(number,[28,29]) then result:=True;
   'split28_31': if in_array(number,[28,31]) then result:=True;
   'split29_30': if in_array(number,[29,30]) then result:=True;
   'split29_32': if in_array(number,[29,32]) then result:=True;
   'split30_33': if in_array(number,[30,31]) then result:=True;
   'split31_32': if in_array(number,[31,32]) then result:=True;
   'split31_34': if in_array(number,[31,34]) then result:=True;
   'split32_33': if in_array(number,[32,33]) then result:=True;
   'split32_35': if in_array(number,[32,35]) then result:=True;
   'split33_36': if in_array(number,[33,36]) then result:=True;
   'split34_35': if in_array(number,[34,35]) then result:=True;
   'split35_36': if in_array(number,[35,36]) then result:=True;
   'single0':  if in_array(number, [0]) then result:=True;
   'single1':  if in_array(number, [1]) then result:=True;
   'single2':  if in_array(number, [2]) then result:=True;
   'single3':  if in_array(number, [3]) then result:=True;
   'single4':  if in_array(number, [4]) then result:=True;
   'single5':  if in_array(number, [5]) then result:=True;
   'single6':  if in_array(number, [6]) then result:=True;
   'single7':  if in_array(number, [7]) then result:=True;
   'single8':  if in_array(number, [8]) then result:=True;
   'single9':  if in_array(number, [9]) then result:=True;
   'single10': if in_array(number,[10]) then result:=True;
   'single11': if in_array(number,[11]) then result:=True;
   'single12': if in_array(number,[12]) then result:=True;
   'single13': if in_array(number,[13]) then result:=True;
   'single14': if in_array(number,[14]) then result:=True;
   'single15': if in_array(number,[15]) then result:=True;
   'single16': if in_array(number,[16]) then result:=True;
   'single17': if in_array(number,[17]) then result:=True;
   'single18': if in_array(number,[18]) then result:=True;
   'single19': if in_array(number,[19]) then result:=True;
   'single20': if in_array(number,[20]) then result:=True;
   'single21': if in_array(number,[21]) then result:=True;
   'single22': if in_array(number,[22]) then result:=True;
   'single23': if in_array(number,[23]) then result:=True;
   'single24': if in_array(number,[24]) then result:=True;
   'single25': if in_array(number,[25]) then result:=True;
   'single26': if in_array(number,[26]) then result:=True;
   'single27': if in_array(number,[27]) then result:=True;
   'single28': if in_array(number,[28]) then result:=True;
   'single29': if in_array(number,[29]) then result:=True;
   'single30': if in_array(number,[30]) then result:=True;
   'single31': if in_array(number,[31]) then result:=True;
   'single32': if in_array(number,[32]) then result:=True;
   'single33': if in_array(number,[33]) then result:=True;
   'single34': if in_array(number,[34]) then result:=True;
   'single35': if in_array(number,[35]) then result:=True;
   'single36': if in_array(number,[36]) then result:=True;
   'voisins':  if in_array(number,[0,2,3,4,7,12,15,18,19,21,22,25,26,28,29,32,35]) then result:=True;
   'tier':     if in_array(number,[7,8,10,11,13,16,23,24,27,30,33,36]) then result:=True;
   'orphelins':if in_array(number,[1,6,9,14,17,20,31,34]) then result:=True;
   'neighbors0':  if in_array(number,[0,3,26,32,15])  then result:=True;
   'neighbors1':  if in_array(number,[1,16,33,20,14]) then result:=True;
   'neighbors2':  if in_array(number,[2,4,21,25,17])  then result:=True;
   'neighbors3':  if in_array(number,[3,12,35,26,0])  then result:=True;
   'neighbors4':  if in_array(number,[4,15,19,21,2])  then result:=True;
   'neighbors5':  if in_array(number,[5,23,10,24,16]) then result:=True;
   'neighbors6':  if in_array(number,[6,17,34,27,13]) then result:=True;
   'neighbors7':  if in_array(number,[7,18,29,28,12]) then result:=True;
   'neighbors8':  if in_array(number,[8,11,30,23,10]) then result:=True;
   'neighbors9':  if in_array(number,[9,14,31,22,18]) then result:=True;
   'neighbors10': if in_array(number,[10,8,23,5,24])  then result:=True;
   'neighbors11': if in_array(number,[11,13,36,30,8]) then result:=True;
   'neighbors12': if in_array(number,[12,7,28,35,3])  then result:=True;
   'neighbors13': if in_array(number,[13,6,27,36,11]) then result:=True;
   'neighbors14': if in_array(number,[14,1,20,31,9])  then result:=True;
   'neighbors15': if in_array(number,[15,0,32,19,4])  then result:=True;
   'neighbors16': if in_array(number,[16,5,24,33,1])  then result:=True;
   'neighbors17': if in_array(number,[17,2,25,34,6])  then result:=True;
   'neighbors18': if in_array(number,[18,9,22,29,7])  then result:=True;
   'neighbors19': if in_array(number,[19,32,15,4,21]) then result:=True;
   'neighbors20': if in_array(number,[20,33,1,14,31]) then result:=True;
   'neighbors21': if in_array(number,[21,19,4,2,25])  then result:=True;
   'neighbors22': if in_array(number,[22,31,9,18,29]) then result:=True;
   'neighbors23': if in_array(number,[23,30,8,10,5])  then result:=True;
   'neighbors24': if in_array(number,[24,10,5,16,33]) then result:=True;
   'neighbors25': if in_array(number,[25,21,2,17,34]) then result:=True;
   'neighbors26': if in_array(number,[26,35,3,0,32])  then result:=True;
   'neighbors27': if in_array(number,[27,34,6,13,36]) then result:=True;
   'neighbors28': if in_array(number,[28,29,7,12,35]) then result:=True;
   'neighbors29': if in_array(number,[29,22,18,7,28]) then result:=True;
   'neighbors30': if in_array(number,[30,36,11,8,23]) then result:=True;
   'neighbors31': if in_array(number,[31,20,14,9,22]) then result:=True;
   'neighbors32': if in_array(number,[32,26,0,15,19]) then result:=True;
   'neighbors33': if in_array(number,[33,24,16,1,20]) then result:=True;
   'neighbors34': if in_array(number,[34,25,17,6,27]) then result:=True;
   'neighbors35': if in_array(number,[35,28,12,3,26]) then result:=True;
   'neighbors36': if in_array(number,[36,27,13,11,30])then result:=True;
   'finalbet0': if in_array(number,[0,10,20,30]) then result:=True;
   'finalbet1': if in_array(number,[1,11,21,31]) then result:=True;
   'finalbet2': if in_array(number,[2,12,22,32]) then result:=True;
   'finalbet3': if in_array(number,[3,13,23,33]) then result:=True;
   'finalbet4': if in_array(number,[4,14,24,34]) then result:=True;
   'finalbet5': if in_array(number,[5,15,25,35]) then result:=True;
   'finalbet6': if in_array(number,[6,16,26,36]) then result:=True;
   'finalbet7': if in_array(number,[7,17,27]) then result:=True;
   'finalbet8': if in_array(number,[8,18,28]) then result:=True;
   'finalbet9': if in_array(number,[9,19,29]) then result:=True;
   'line1_3': if in_array(number,[ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12]) then result:=True;
   'line1_4': if in_array(number,[ 1, 2, 3, 4, 5, 6,10,11,12,13,14,15]) then result:=True;
   'street1_3':  if in_array(number,[ 1, 2, 3, 7, 8, 9]) then result:=True;
   'street1_4':  if in_array(number,[ 1, 2, 3,10,11,12]) then result:=True;
   //here you can add other elements
 end;
end;

procedure wait_ms(ms_in);
{wait ms_in milliseconds}
var y, mth, d, h, m, s, ms, tfinal, tnow;
begin
 DecodeDate(now, y,mth,d); DecodeTime(now, h,m,s,ms);
 ms:=ms+ms_in;
 s:=s+(ms div 1000); ms:=(ms mod 1000);
 m:=m+(s div 60); s:=(s mod 60);
 h:=h+(m div 60); m:=(m mod 60);
 d:=d+(h div 24); h:=(h mod 24);
 case mth of
  1,3,5,7,8,10,12:if d>31 then begin Inc(mth); d:=1; end;
  4,6,9,11:if d>30 then begin Inc(mth); d:=1; end;
  2:begin
      if (y mod 4)= 0 then if d>29 then begin Inc(mth); d:=1; end;
      if (y mod 4)<>0 then if d>28 then begin Inc(mth); d:=1; end;
    end;
 end;
 if mth>12 then begin Inc(y); mth:=1; end;
 tfinal:=y*100000000+mth*1000000+(d*1000000000+h*10000000+m*100000+s*1000+ms)/100000;
 while 1=1 do begin
   DecodeDate(now, y,mth,d); DecodeTime(now, h,m,s,ms);
   tnow:=y*100000000+mth*1000000+(d*1000000000+h*10000000+m*100000+s*1000+ms)/100000;
   if (tnow>=tfinal) then break;
 end;
end;
