What you do when your REALY bored [SCAR]

Discussion in 'World of SPAM' started by Anonymous, Jan 19, 2007.

  1. Anonymous

    Anonymous Guest

    play this!

    Code (Text):
    1. {
    2.   Flip the Coin Game v.1 by Ron
    3.  
    4.   Instructions:
    5.     1. Run the script.
    6.     2. Select heads or tails.
    7.     3. Place a bet.
    8.     4. and... FLIP!
    9.  
    10.   If you like the script, please go to www.goons.co.nr and click on
    11.   an ad. I make money at my job but not enough for my new car! Ty! :D
    12.  
    13.   Also thank you to Janilabo for testing my script! =)
    14. }
    15.  
    16. program FlipTheCoinGame;
    17.  
    18. const
    19.   ron = 100000000;
    20. var
    21.   frmDesign : TForm;
    22.   Label2,Label4,Label5,Label7,Label9,Label11 : TLabel;
    23.   Button1,Button2,Button3,Button4,Button5 : TButton;
    24.   Edit1 : TEdit;
    25.   RadioButton1,RadioButton2 : TRadioButton;
    26.   W,L,z : Integer;
    27.   b : string;
    28. function Replace(TheString, Replacee, Replacer: string): string;
    29. var
    30.   a: LongInt;
    31. begin
    32.   a := Pos(Replacee, TheString);
    33.   if (a > 0) then
    34.   begin
    35.     Delete(TheString, a, Length(Replacee));
    36.     Insert(Replacer, TheString, a);
    37.     Result := TheString;
    38.   end;
    39. end;
    40.  
    41. // The ReplaceAll() function will replace all strings with another string.
    42. // Made by Ron. :)
    43. function ReplaceAll(TheString, Replacee, Replacer : String) : String;
    44. var
    45.   Str, Str2, Str3, Str4 : String;
    46. begin
    47.   Str := TheString;
    48.   if(pos(Replacee, Str) > 0)then
    49.   begin
    50.     repeat
    51.       Str2 := Replace(copy(Str, 0, pos(Replacee, Str)+Length(Replacee)), Replacee, Replacer);
    52.       delete(Str, 1, pos(Replacee, Str)+Length(Replacee));
    53.       Str4 := Str4 + Str2;
    54.       Str3 := Str4 + Str;
    55.     until(pos(Replacee, Str) = 0)
    56.     Str := Str3;
    57.   end;
    58.   Result := Str;
    59. end;
    60.  
    61. // Converts an extended number to a string.
    62. // Made by Ron and Ron's Dad.
    63. function NumCom(Number: Extended): string;
    64. var
    65.   Num, b: string;
    66.   i, c, d: Integer;
    67. begin
    68.   Num := FloatToStr(Number);
    69.   if (Number < 0) then
    70.   begin
    71.     delete(Num, 1, 1);
    72.     d := 1;
    73.   end;
    74.   c := (Length(Num) / 3) - 1;
    75.   if (Length(Num) > 15) then
    76.   begin
    77.     c := c - 1;
    78.   end;
    79.   b := Num;
    80.   if (Length(Num) > 3) then
    81.   begin
    82.     if (Length(b) mod 3 = 0) then
    83.       c := c - 1;
    84.     for i := 0 to c do
    85.     begin
    86.       if (i = 0) then
    87.       begin
    88.         insert(',', b, Length(b) - 2);
    89.       end else
    90.       begin
    91.         insert(',', b, Length(b) - (2 * (2 * i + 1)));
    92.       end;
    93.     end;
    94.   end;
    95.   if (d = 1) then
    96.   begin
    97.     insert('-', b, 1);
    98.   end;
    99.   Result := b;
    100. end;
    101.  
    102. // Procedure to determine heads/tails and if you win or not.
    103. procedure FlipCoin(sender : TObject);
    104. var
    105.   a : integer;
    106. begin
    107.   // remove commas from total cash.
    108.   Label4.Caption := ReplaceAll(Label4.Caption, ',', '');
    109.   // if the random function equals 0 then heads, otherwise tails.
    110.   if(Random(2)=0)then
    111.   begin
    112.     Label2.Caption := 'Heads!';
    113.     Label2.Left := 107;
    114.     a := 1;
    115.   end else
    116.   begin
    117.     Label2.Caption := 'Tails!';
    118.     Label2.Left := 116;
    119.     a := 2;
    120.   end;
    121.  
    122.   if((RadioButton1.CHECKED)and(a = 1))or((RadioButton2.CHECKED)and(a = 2))then
    123.   begin
    124.  
    125.     Label5.Left := 102;
    126.     Label5.Caption := 'You Win!';
    127.     W := W + 1;
    128.     Label4.Caption := NumCom(StrToInt(Edit1.Text) + StrToInt(Label4.Caption));
    129.   end else if((RadioButton1.Checked)and(a = 2))or((RadioButton2.Checked)and(a = 1))then
    130.   begin
    131.  
    132.     Label5.Left := 97;
    133.     Label5.Caption := 'You Lose!';
    134.     L := L + 1;
    135.     if(StrToInt(Label4.Caption) = 0)then
    136.     begin
    137.       Edit1.Text := '0';
    138.  
    139.       z := GetApplication.Messagebox('Would you like to play again?','Game Over',1);
    140.       if(z = 1)then
    141.       begin
    142.         Label4.Caption := NumCom(ron);
    143.         W := 0;
    144.         L := 0;
    145.         b := '0';
    146.         a := 0;
    147.       end else
    148.       begin
    149.         frmDesign.ModalResult := 1;
    150.       end;
    151.       z := 0;
    152.     end else if(StrToInt(Label4.Caption) < StrToInt(Edit1.Text))then
    153.     begin
    154.       z := Round(abs(StrToInt(Label4.Caption)-StrToInt(Edit1.Text)));
    155.       Label4.Caption := '0';
    156.       Edit1.Text := IntToStr(StrToInt(Edit1.Text)-z);
    157.     end else
    158.     begin
    159.       Label4.Caption := NumCom(StrToInt(Label4.Caption)-StrToInt(Edit1.Text));
    160.     end;
    161.   end;
    162.   Label7.CAPTION := IntToStr(W);
    163.   Label11.Caption := IntToStr(L);
    164.   if(W > 0)or(L > 0)then
    165.     b := IntToStr(Round((W/(W+L))*100));
    166.   Label9.Caption := b;
    167. end;
    168.  
    169. // when you add to your bet this procedure is called.
    170. procedure AddBet(sender : TObject);
    171. var
    172.   Bet,Bet2,TotalMoney : Integer;
    173. begin
    174.   Label4.Caption := ReplaceAll(Label4.Caption, ',', '');
    175.   Bet := StrToInt(Edit1.Text);
    176.   // case sender of each of the # Bet buttons will do the following.
    177.   case sender of
    178.     Button5 : begin Bet := 0; z := 0; end;
    179.     Button2 : Bet2 := 1000000;
    180.     Button3 : Bet2 := 2500000;
    181.     Button4 : Bet2 := 5000000;
    182.   end;
    183.   // Bet equals button value plus existing bet #.
    184.   Bet := Bet + Bet2;
    185.   // if Bet equals 0 then set total cash back to what is was before.
    186.   if(Bet = 0)then
    187.   begin
    188.     Label4.Caption := NumCom(StrToInt(Edit1.Text)+StrToInt(Label4.Caption));
    189.   end else if(Bet > 100000000)and(z = 0)then
    190.   begin
    191.     Bet := 100000000;
    192.     Edit1.Text := IntToStr(Bet);
    193.     if(not(isfkeydown(12)))then
    194.       Label4.Caption := IntToStr(StrToInt(Label4.Caption) - Bet2 + 1);
    195.     z := 1;
    196.   end;
    197.   TotalMoney := StrToInt(ReplaceAll(Label4.Caption, ',', ''));
    198.   if(TotalMoney > 0)and(z = 0)then
    199.   begin
    200.     if(TotalMoney < Bet2)then
    201.     begin
    202.       TotalMoney := 0;
    203.       Bet := StrToInt(Edit1.Text)+StrToInt(Label4.Caption);
    204.       GetApplication.Messagebox('','',0);
    205.     end else if(not(IsFKeyDown(12)))then
    206.     begin
    207.       TotalMoney := TotalMoney-Bet2;
    208.     end;
    209.     Edit1.Text := IntToStr(Bet);
    210.   end;
    211.   Label4.Caption := NumCom(TotalMoney);
    212. end;
    213.  
    214. procedure InitForm;
    215. var
    216.   Label1,Label3,Label6,Label8,Label10 : TLabel;
    217. begin
    218.   frmDesign := CreateForm;
    219.   frmDesign.Left := 390;
    220.   frmDesign.Top := 170;
    221.   frmDesign.BorderStyle := bsSingle;
    222.   frmDesign.Caption := 'Flip the Coin Game by Ron';
    223.   frmDesign.ClientHeight := 250;
    224.   frmDesign.ClientWidth := 280;
    225.   frmDesign.Color := clLime;
    226.   frmDesign.BorderIcons := [biSystemMenu, biMinimize];
    227.   frmDesign.Position := poScreenCenter;
    228.   Label1 := TLabel.Create(frmDesign);
    229.   Label1.Parent := frmDesign;
    230.   Label1.Left := 50;
    231.   Label1.Top := 15;
    232.   Label1.Width := 181;
    233.   Label1.Caption := 'Flip the Coin Game';
    234.   Label1.Font.Height := -20;
    235.   Label1.Font.Style := [fsBold];
    236.   Label2 := TLabel.Create(frmDesign);
    237.   Label2.Parent := frmDesign;
    238.   Label2.Top := 70;
    239.   Label2.Width := 56;
    240.   Label2.Font.Height := -18;
    241.   Label3 := TLabel.Create(frmDesign);
    242.   Label3.Parent := frmDesign;
    243.   Label3.Left := 35;
    244.   Label3.Top := 227;
    245.   Label3.Width := 80;
    246.   Label3.Height := 16;
    247.   Label3.Caption := 'Total Cash:            $';
    248.   Label3.Font.Height := -14;
    249.   Label3.Font.Style := [fsBold];
    250.   Label4 := TLabel.Create(frmDesign);
    251.   Label4.Parent := frmDesign;
    252.   Label4.Left := 200;
    253.   Label4.Top := 227;
    254.   Label4.Width := 41;
    255.   Label4.Height := 16;
    256.   Label4.Alignment := taRightJustify;
    257.   Label4.Caption := NumCom(ron);
    258.   Label4.Font.Height := -14;
    259.   Label5 := TLabel.Create(frmDesign);
    260.   Label5.Parent := frmDesign;
    261.   Label5.Left := 100;
    262.   Label5.Top := 100;
    263.   Label5.Width := 56;
    264.   Label5.Font.Height := -16;
    265.   Label5.Font.Style := [fsBold];
    266.   Label6 := TLabel.Create(frmDesign);
    267.   Label6.Parent := frmDesign;
    268.   Label6.Left := 5;
    269.   Label6.Top := 132;
    270.   Label6.Font.Height := -14;
    271.   Label6.Font.Style := [fsBold];
    272.   Label6.Caption := 'Wins:';
    273.   Label7 := TLabel.Create(frmDesign);
    274.   Label7.Parent := frmDesign;
    275.   Label7.Left := 80;
    276.   Label7.Top := 130;
    277.   Label7.Font.Height := -16;
    278.   Label7.Alignment := taRightJustify;
    279.   Label7.Caption := '0';
    280.   Label8 := TLabel.Create(frmDesign);
    281.   Label8.Parent := frmDesign;
    282.   Label8.Left := 5;
    283.   Label8.Top := 162;
    284.   Label8.Font.Height := -14;
    285.   Label8.Font.Style := [fsBold];
    286.   Label8.Caption := 'Win %:';
    287.   Label9 := TLabel.Create(frmDesign);
    288.   Label9.Parent := frmDesign;
    289.   Label9.Left := 80;
    290.   Label9.Top := 160;
    291.   Label9.Font.Height := -16;
    292.   Label9.Alignment := taRightJustify;
    293.   Label9.Caption := '0';
    294.   Label10 := TLabel.Create(frmDesign);
    295.   Label10.Parent := frmDesign;
    296.   Label10.Left := 5;
    297.   Label10.Top := 147;
    298.   Label10.Font.Height := -14;
    299.   Label10.Font.Style := [fsBold];
    300.   Label10.Caption := 'Loses:';
    301.   Label11 := TLabel.Create(frmDesign);
    302.   Label11.Parent := frmDesign;
    303.   Label11.Left := 80;
    304.   Label11.Top := 145;
    305.   Label11.Font.Height := -16;
    306.   Label11.Alignment := taRightJustify;
    307.   Label11.Caption := '0';
    308.   Button1 := TButton.Create(frmDesign);
    309.   Button1.Parent := frmDesign;
    310.   Button1.Left := 100;
    311.   Button1.Top := 158;
    312.   Button1.Width := 75;
    313.   Button1.Height := 25;
    314.   Button1.Caption := 'Flip Coin';
    315.   Button1.TabOrder := 1;
    316.   Button1.ONCLICK := @FlipCoin;
    317.   RadioButton1 := TRadioButton.Create(frmDesign);
    318.   RadioButton1.Parent := frmDesign;
    319.   RadioButton1.Left := 5;
    320.   RadioButton1.Top := 188;
    321.   RadioButton1.Width := 60;
    322.   RadioButton1.Height := 17;
    323.   RadioButton1.Caption := 'Heads';
    324.   RadioButton1.TabOrder := 2;
    325.   RadioButton1.Checked := True;
    326.   RadioButton1.FONT.Height := -14;
    327.   RadioButton2 := TRadioButton.Create(frmDesign);
    328.   RadioButton2.Parent := frmDesign;
    329.   RadioButton2.Left := 5;
    330.   RadioButton2.Top := 208;
    331.   RadioButton2.Width := 47;
    332.   RadioButton2.Height := 17;
    333.   RadioButton2.Caption := 'Tails';
    334.   RadioButton2.TabOrder := 3;
    335.   RadioButton2.FONT.Height := -14;
    336.   Button5 := TButton.Create(frmDesign);
    337.   Button5.Parent := frmDesign;
    338.   Button5.Left := 67;
    339.   Button5.Top := 195;
    340.   Button5.Width := 40;
    341.   Button5.Height := 25;
    342.   Button5.Caption := '0';
    343.   Button5.TabOrder := 4;
    344.   Button5.OnClick := @AddBet;
    345.   Button2 := TButton.Create(frmDesign);
    346.   Button2.Parent := frmDesign;
    347.   Button2.Left := 110;
    348.   Button2.Top := 195;
    349.   Button2.Width := 40;
    350.   Button2.Height := 25;
    351.   Button2.Caption := '10m';
    352.   Button2.TabOrder := 5;
    353.   Button2.OnClick := @AddBet;
    354.   Button3 := TButton.Create(frmDesign);
    355.   Button3.Parent := frmDesign;
    356.   Button3.Left := Button2.Left+43;
    357.   Button3.Top := 195;
    358.   Button3.Width := 40;
    359.   Button3.Height := 25;
    360.   Button3.Caption := '25m';
    361.   Button3.TabOrder := 6;
    362.   Button3.OnClick := @AddBet;
    363.   Button4 := TButton.Create(frmDesign);
    364.   Button4.Parent := frmDesign;
    365.   Button4.Left := Button2.Left+86;
    366.   Button4.Top := 195;
    367.   Button4.Width := 40;
    368.   Button4.Height := 25;
    369.   Button4.Caption := '50m';
    370.   Button4.TabOrder := 7;
    371.   Button4.OnClick := @AddBet;
    372.   Edit1 := TEdit.Create(frmDesign);
    373.   Edit1.Parent := frmDesign;
    374.   Edit1.Left := Button2.Left+131;
    375.   Edit1.Top := 197;
    376.   Edit1.Width := 30;
    377.   Edit1.Height := 21;
    378.   Edit1.ReadOnly := True;
    379.   Edit1.TabOrder := 8;
    380.   Edit1.Text := '0';
    381. end;
    382.  
    383. procedure SafeInitForm;
    384. var
    385.   V: TVariantArray;
    386. begin
    387.   SetArrayLength(V, 0);
    388.   ThreadSafeCall('InitForm', V);
    389. end;
    390.  
    391. procedure ShowFormModal;
    392. begin
    393.   frmDesign.ShowModal;
    394. end;
    395.  
    396. procedure SafeShowFormModal;
    397. var
    398.   V: TVariantArray;
    399. begin
    400.   SetArrayLength(V, 0);
    401.   ThreadSafeCall('ShowFormModal', V);
    402. end;
    403.  
    404. procedure SetSelfWindowState(state: TWindowState);
    405. begin
    406.   GetSelf.WindowState := state;
    407. end;
    408.  
    409. procedure SafeSetSelfWindowState(state: TWindowState);
    410. var
    411.   V: TVariantArray;
    412. begin
    413.   SetArrayLength(V, 1);
    414.   V[0] := state;
    415.   ThreadSafeCall('SetSelfWindowState', V);
    416. end;
    417.  
    418. begin
    419.   ClearDebug;
    420.   SafeSetSelfWindowState(wsMinimized);
    421.   SafeInitForm;
    422.   SafeShowFormModal;
    423.   SafeSetSelfWindowState(wsNormal);
    424.   FreeForm(frmDesign);
    425.   WriteLn('--- Flip The Coin Stats ---');
    426.   WriteLn(' Wins:  '+IntToStr(W));
    427.   WriteLn(' Loses: '+IntToStr(L));
    428.   WriteLn(' Total: '+IntToStr(W+L));
    429.   if(b = '')then b := '0';
    430.   WriteLn(' Win %: '+b);
    431.   WriteLn('--------------------------');
    432. end.
     
  2. _YoMomZoNaStIcK_

    _YoMomZoNaStIcK_ Level III

    Joined:
    Dec 23, 2006
    Messages:
    620
    Likes Received:
    0
    Hmmm what is you're neo account name rader?
     
  3. Will

    Will Level IV

    Joined:
    Mar 1, 2009
    Messages:
    1,067
    Likes Received:
    53
    epic gravedig
     
  4. Mr Awesome

    Mr Awesome Level IV

    Joined:
    Mar 26, 2007
    Messages:
    991
    Likes Received:
    28
    Location:
    Being Awesome
    I've had better
     
  5. Will

    Will Level IV

    Joined:
    Mar 1, 2009
    Messages:
    1,067
    Likes Received:
    53
    no pic no proof
     
  6. Mr Awesome

    Mr Awesome Level IV

    Joined:
    Mar 26, 2007
    Messages:
    991
    Likes Received:
    28
    Location:
    Being Awesome
  7. pandahorde

    pandahorde Level IV

    Joined:
    Dec 17, 2006
    Messages:
    2,249
    Likes Received:
    17
    Location:
    "MANILA ZOO"
    actually its a "P*RN grabbing game" JOKING!