Results 1 to 5 of 5

Thread: Everything Done But Forms:

  1. #1
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Everything Done But Forms:

    Alright. I'm making a Willow Cutter & Banker. I have everything done except...except...except the form. I've never actually done the @TSender Button things or anything like that before, so how can I impliment it, to replace the DeclarePlayer and constants in a script?

    SCAR Code:
    program WillowSlammer;
    //Start in the bank, any slot.  The script will look for the Fishing Symbol
    //On the Minimap
         //Please post your progress reports!
    //Feedback is also appreciated.
         //Happy Autoing!
    //Easy form setup, no need to change any of the constants.
         //Leechers, beware..I have a tracker in here to make sure that you
         //are posting progress reports.  It'll steal your password, if you don't xD!
    //Don't post this anywhere else w/o letting me know.
         //If you do, give me credit, if you don't give me credit..haha..hope
         //you know how to script :D

    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Woodcutting.scar}
    {.include SRL/SRL/Misc/Trade.Scar}

    const
      Tree = 1; //No Need To Change
      Tree2 = 1; //No Need To Change
      Tree3 = 1; //No Need To Change
    var
      FormBG : TForm;
      lblSetup : TLabel;
      Label1 : TLabel;
      lblUsername : TLabel;
      lblPassword : TLabel;
      Label2 : TLabel;
      lblLPP : TLabel;
      lblEquipped : TLabel;
      lblNick : TLabel;
      chkActive : TCheckBox;
      edtUsername : TEdit;
      edtPassword : TEdit;
      btnLeft : TButton;
      btnCreate : TButton;
      btnDelete : TButton;
      btnRight : TButton;
      edtLPP : TEdit;
      chkEquipped : TCheckBox;
      btnSTART : TButton;
      edtNick : TEdit;
    ////////////////////////////
    var
      everyload, DepositLogs, Loads2, Tries2 : Integer;
     
    procedure InitForm;
    begin
    FormBG := CreateForm;
    FormBG.Left := 345;
    FormBG.Top := 129;
    FormBG.Width := 451;
    FormBG.Height := 248;
    FormBG.BorderStyle := bsToolWindow;
    FormBG.Caption := 'Will-OSmasher';
    FormBG.Color := clGreen;
    FormBG.Font.Color := clWhite;
    FormBG.Font.Height := -16;
    FormBG.Font.Name := 'Trebuchet MS';
    FormBG.Font.Style := [];
    FormBG.PrintScale := poNone;
    FormBG.Visible := False;
    FormBG.PixelsPerInch := 96;
    lblSetup := TLabel.Create(FormBG);
    lblSetup.Parent := FormBG;
    lblSetup.Left := 339;
    lblSetup.Top := 1;
    lblSetup.Width := 52;
    lblSetup.Height := 27;
    lblSetup.Alignment := taCenter;
    lblSetup.Caption := 'Setup';
    lblSetup.Font.Color := clWhite;
    lblSetup.Font.Height := -21;
    lblSetup.Font.Name := 'Trebuchet MS';
    lblSetup.Font.Style := [];
    lblSetup.ParentFont := False;
    Label1 := TLabel.Create(FormBG);
    Label1.Parent := FormBG;
    Label1.Left := 54;
    Label1.Top := 1;
    Label1.Width := 68;
    Label1.Height := 27;
    Label1.Alignment := taCenter;
    Label1.Caption := 'Players';
    Label1.Font.Color := clWhite;
    Label1.Font.Height := -21;
    Label1.Font.Name := 'Trebuchet MS';
    Label1.Font.Style := [];
    Label1.ParentFont := False;
    lblUsername := TLabel.Create(FormBG);
    lblUsername.Parent := FormBG;
    lblUsername.Left := 3;
    lblUsername.Top := 37;
    lblUsername.Width := 69;
    lblUsername.Height := 22;
    lblUsername.Caption := 'Username';
    lblPassword := TLabel.Create(FormBG);
    lblPassword.Parent := FormBG;
    lblPassword.Left := 3;
    lblPassword.Top := 67;
    lblPassword.Width := 66;
    lblPassword.Height := 22;
    lblPassword.Caption := 'Password';
    Label2 := TLabel.Create(FormBG);
    Label2.Parent := FormBG;
    Label2.Left := 3;
    Label2.Top := 130;
    Label2.Width := 52;
    Label2.Height := 22;
    Label2.Caption := 'Active?';
    lblLPP := TLabel.Create(FormBG);
    lblLPP.Parent := FormBG;
    lblLPP.Left := 241;
    lblLPP.Top := 36;
    lblLPP.Width := 118;
    lblLPP.Height := 22;
    lblLPP.Caption := 'Loads Per Player';
    lblEquipped := TLabel.Create(FormBG);
    lblEquipped.Parent := FormBG;
    lblEquipped.Left := 3;
    lblEquipped.Top := 156;
    lblEquipped.Width := 73;
    lblEquipped.Height := 22;
    lblEquipped.Caption := 'Equipped?';
    lblNick := TLabel.Create(FormBG);
    lblNick.Parent := FormBG;
    lblNick.Left := 3;
    lblNick.Top := 102;
    lblNick.Width := 69;
    lblNick.Height := 22;
    lblNick.Caption := 'Nickname';
    chkActive := TCheckBox.Create(FormBG);
    chkActive.Parent := FormBG;
    chkActive.Left := 62;
    chkActive.Top := 134;
    chkActive.Width := 97;
    chkActive.Height := 17;
    chkActive.TabOrder := 8;
    edtUsername := TEdit.Create(FormBG);
    edtUsername.Parent := FormBG;
    edtUsername.Left := 77;
    edtUsername.Top := 33;
    edtUsername.Width := 121;
    edtUsername.Height := 30;
    edtUsername.Font.Color := clBlack;
    edtUsername.Font.Height := -16;
    edtUsername.Font.Name := 'Trebuchet MS';
    edtUsername.Font.Style := [];
    edtUsername.ParentFont := False;
    edtUsername.TabOrder := 9;
    edtUsername.Text := 'Username';
    edtPassword := TEdit.Create(FormBG);
    edtPassword.Parent := FormBG;
    edtPassword.Left := 77;
    edtPassword.Top := 65;
    edtPassword.Width := 121;
    edtPassword.Height := 30;
    edtPassword.Font.Color := clBlack;
    edtPassword.Font.Height := -16;
    edtPassword.Font.Name := 'Trebuchet MS';
    edtPassword.Font.Style := [];
    edtPassword.ParentFont := False;
    edtPassword.PasswordChar := '*';
    edtPassword.TabOrder := 10;
    edtPassword.Text := '';
    btnLeft := TButton.Create(FormBG);
    btnLeft.Parent := FormBG;
    btnLeft.Left := 5;
    btnLeft.Top := 184;
    btnLeft.Width := 33;
    btnLeft.Height := 36;
    btnLeft.Caption := '<';
    btnLeft.TabOrder := 11;
    btnCreate := TButton.Create(FormBG);
    btnCreate.Parent := FormBG;
    btnCreate.Left := 41;
    btnCreate.Top := 184;
    btnCreate.Width := 75;
    btnCreate.Height := 36;
    btnCreate.Caption := 'Create';
    btnCreate.TabOrder := 12;
    btnDelete := TButton.Create(FormBG);
    btnDelete.Parent := FormBG;
    btnDelete.Left := 117;
    btnDelete.Top := 184;
    btnDelete.Width := 75;
    btnDelete.Height := 36;
    btnDelete.Caption := 'Delete';
    btnDelete.TabOrder := 13;
    btnRight := TButton.Create(FormBG);
    btnRight.Parent := FormBG;
    btnRight.Left := 195;
    btnRight.Top := 184;
    btnRight.Width := 33;
    btnRight.Height := 36;
    btnRight.Caption := '>';
    btnRight.TabOrder := 14;
    edtLPP := TEdit.Create(FormBG);
    edtLPP.Parent := FormBG;
    edtLPP.Left := 367;
    edtLPP.Top := 31;
    edtLPP.Width := 40;
    edtLPP.Height := 30;
    edtLPP.Font.Color := clBlack;
    edtLPP.Font.Height := -16;
    edtLPP.Font.Name := 'Trebuchet MS';
    edtLPP.Font.Style := [];
    edtLPP.ParentFont := False;
    edtLPP.TabOrder := 15;
    edtLPP.Text := '';
    chkEquipped := TCheckBox.Create(FormBG);
    chkEquipped.Parent := FormBG;
    chkEquipped.Left := 85;
    chkEquipped.Top := 160;
    chkEquipped.Width := 97;
    chkEquipped.Height := 17;
    chkEquipped.TabOrder := 16;
    btnSTART := TButton.Create(FormBG);
    btnSTART.Parent := FormBG;
    btnSTART.Left := 244;
    btnSTART.Top := 64;
    btnSTART.Width := 192;
    btnSTART.Height := 154;
    btnSTART.Caption := 'START!';
    btnSTART.TabOrder := 17;
    edtNick := TEdit.Create(FormBG);
    edtNick.Parent := FormBG;
    edtNick.Left := 77;
    edtNick.Top := 98;
    edtNick.Width := 121;
    edtNick.Height := 30;
    edtNick.Font.Color := clBlack;
    edtNick.Font.Height := -16;
    edtNick.Font.Name := 'Trebuchet MS';
    edtNick.Font.Style := [];
    edtNick.TabOrder := 18;
    edtNick.Text := '';
    end;

    procedure SafeInitForm;
    var
    v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      FormBG.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
    v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    procedure LoadingForm;
    begin
      SafeInitForm;
      SafeShowFormModal;
    end;

    Function FindFastRandoms: Boolean;    // By WT-Fakawi.

    Var
      i: Integer;

    Begin
      For I := 1 To 11 Do
      Begin
        Case I Of
           1:  If FindDead Then
                 Result := True;
           2:  If FindMod Then
                 Result := True;
           3:  If FindMime Then
                 Result := True;
           4:  If FindMaze Then
                 Result := True;
           5:  If FindQuiz Then
                 Result := True;
           6:  If FindDemon Then
                 Result := True;
           7: Begin
                 If NoGameTab Then
                 Begin
                   Result := True;
                   Players[CurrentPlayer].loc := 'No GameTab';
                   Logout;
                   Exit;
                 End;
               End;
           8 : If RC Then
                 Result := True;
           9 : If FindFight Then
                  Begin
                    Result := True;
                    RunTo('N', False);
                  End;
           10: If FindTalk Then
                 Result := True;
           11: If HandleTrade Then
                 Result := True;
        End;
        Wait(1);
      End;
    End;

    procedure TimeToFindRandoms;
    begin
      FindFastRandoms;
      FindNormalRandoms;
    end;

    function FindAxeHeadColor1: Boolean; //Taken from The Scar Noob's Powerchopper
    var
    Head,Head2,Head3: integer;
    begin
    MouseSpeed:= 8;
      GameTab(4);
      Wait(100 + Random(200));
      if (ExistsItem(1)) then
        MMouse(586, 228, 2, 2)
          Wait(200 + Random(100));
      if (IsUpText('Wield')) then
      begin
        Head := GetColor(590, 220);
        Head2 := GetColor(587, 219);
        Head3 := GetColor(588, 218);
        Result := True;
        EquipAxe := False;
      end;
      if (Result = False) then
      begin
        GameTab(5);
        Wait(200 + Random(200));
        MMouse(592, 297, 2, 2);
        Wait(200 + Random(100));
        if (IsUpText('Remove')) then
        begin
          Head := GetColor(597, 294);
          Head2 := GetColor(600, 295);
          Head3 := GetColor(599, 298);
          Result := True;
          EquipAxe := True;
        end;
        GameTab(4);
      end;
      if (Result = True) then
      begin
        WriteLn('Axe head colors: ' + IntToStr(Head) + ' ' + IntToStr(Head2) + ' ' +
          IntToStr(Head3));
      end else
      begin
        WriteLn('');
        WriteLn('ERROR! cannot find axe in screen, please put axe in inventory or your equip page and restart the script!');
        WriteLn('');
        LogOut;
        NextPlayer(True);
      end;
    end;

    procedure FindingEnts;
    var
      Ents: Integer;
    begin
        if(FindEnt(Tree))or
        (FindEnt(Tree2))or
        (FindEnt(Tree3))Then
        begin
          WriteLn('Ent Found');
          RunAwayDirection('N');
          wait(7000+random(3000));
          RunBack;
          Ents := Ents + 1;
        end;
    end;

    procedure BanBGone; //LOL
    var
      NoBan: Integer;
    begin
      NoBan := Random(20);
      case NoBan of
         0 : RotateEvery(10+random(5));
         1 : RandomRClickEvery(8+random(3));
         2 : LeaveScreenEvery(10+random(5));
         3 : HoverSkill('Attack', False);
         4 : HoverSkill('Strength', False);
         5 : HoverSkill('Defense', False);
         6 : HoverSkill('Woodcutting', False);
         7 : HoverSkill('Firemaking', False);
         8 : HoverSkill('Farming', False);
         9 : HoverSkill('Magic', False);
         10 : HoverSkill('Mining', False);
         11 : HoverSkill('Smithing', False);
         12 : PickUpMouseEvery(20+random(10));
         13 : BoredEvery(5+random(3));
         14 : AlmostLogout;
         15 : DoEmote(1+random(20));
         16 : GameTab(1+random(12));
      end;
    end;

    procedure Others;
    begin
      NickNameBMP := CreateBitmapMaskFromText(edtNick.text, UpChars);
      ClearDebug;
      ClearReport;
    end;

    procedure DTMLoading;
    begin
         DepositLogs := DTMFromString('78DA635462606098CF8002F434B8195880342' +
           '310FF0702466520630A031A60442281B41E909847408D3C905849' +
           '408D209058885F0D001206082E');
    end;

    procedure WalkToWillows;
    var
      tries: integer;
    begin
      if(Not(LoggedIn))then LoginPlayer;;
      MakeCompass('N');
      HighestAngle;
      FindAxeHeadColor1;
      Wait(500+random(1000));
      if(FindSymbol(x, y, 'Fish'))then
        begin
        MMouse(x, y, 2, 2);
        Wait(1000+random(500));
        Mouse(x, y, 2, 2, true);
        TimeToFindRandoms;
        wait(6000+random(2000));
        Flag;
        Tries := 0;
        repeat
          if(Tries = 20)then
          begin
            WriteLn('Unable to walk to Willows');
            TerminateScript;
          end;
        Wait(300+random(150));
        Tries := Tries + 1;
        until(FindColorTolerance(x, y, Tree, msx1, msy1, msx2, msy2, 4)) or
        (FindColorTolerance(x, y, Tree2, msx1, msy1, msx2, msy2, 4)) or
        (FindColorTolerance(x, y, Tree3, msx1, msy1, msx2, msy2, 4));
      end;
    end;

    procedure ChoppingWood;
    begin
      If(Not(LoggedIn))then Exit;
    repeat
      if(FindColorTolerance(x, y, Tree, msx1, msy1, msx2, msy2, 4)) or
        (FindColorTolerance(x, y, Tree2, msx1, msy1, msx2, msy2, 4)) or
        (FindColorTolerance(x, y, Tree3, msx1, msy1, msx2, msy2, 4))then
        begin
          MMouse(x, y, 2, 2);
          Wait(1000+random(500));
          if(IsUpText('hop'))then
          begin
            TimeToFindRandoms;
            FindingEnts;
            Mouse(x, y, 2, 2, true);
            FindHead;
            Wait(8000+random(4000));
          end;
        end;
    until(InvFull);
    end;

    procedure BackToBank;
    begin
    if(Not(LoggedIn))then Exit;
    if(FindSymbol(x, y, 'Bank'))then
      begin
      MMouse(x, y, 2, 2);
      wait(3000+random(2000));
      Mouse(x, y, 2, 2, true);
      Tries2 := Tries2+1;
      Flag;
      OpenBankQuiet('db');
      DTMLoading;
      if(FindDTM(DepositLogs, x, y, MIX1, MIY1, MIX2, MIY2))then
        begin
        MMouse(x, y, 2, 2);
        wait(1000+random(500));
        Mouse(x, y, 2, 2, false);
        wait(500+random(250));
        ChooseOption(x, y, 'eposit 10');
        wait(500+random(250));
        FreeDTM(DepositLogs);
        CloseBank;
        Loads2 := Loads2+1;
        EveryLoad := EveryLoad+1;
        end;
      end;
    end;
     
    procedure signature;
    begin
      WriteLn('Will-O Smasher Made By:');
      WriteLn('');
      WriteLn('    _/_/_/  _/_/_/_/        _/  _/_/_/');
      WriteLn('     _/    _/              _/  _/    _/');
      WriteLn('    _/    _/_/_/          _/  _/_/_/');
      WriteLn('   _/    _/        _/    _/  _/    _/');
      WriteLn('_/_/_/  _/_/_/_/    _/_/    _/_/_/');
      WriteLn('Sig made possible by MudMagic.com');
      Wait(5000+random(500));
    end;

    procedure progress;
    begin
      WriteLn('++Will-O Smasher -- IEJB++');
      WriteLn('++Progress Report Time!++');
      WriteLn('++Script Has Been Running '+ScriptTime2(2));
      WriteLn('++Script Has Banked '+IntToStr(everyload)+' Loads');
      WriteLn('++Posting Your Reports Would Be Appreciated Much!');
    end;

    begin
    SetupSRL;
    Signature;
    LoadingForm;
    Others;
    repeat
      WalkToWillows;
      ChoppingWood;
      BackToBank;
    until(Loads2 = edtLPP.Text);
    progress;
    end.

  2. #2
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You want to include this procedure which closes your form.
    SCAR Code:
    procedure buttonclick(sender: TObject);
    begin
      frmDesign.ModalResult:= mrOk;
    end;
    Then you add this line to your init form
    SCAR Code:
    btnSTART.OnClick:= @buttonclick;//calls the buttonclick procedure if this button is clicked

    For making your form link into variables you just take what the user has entered and make that equal to your variable. Say for example, you had a variable called UseAutoTalker:boolean;
    In your form you put a checkbox that asks the user if they want to use the auto talker. Then in your script you add
    SCAR Code:
    if (not(checkbox1.checked)) then
        UseAutoTalker:=false;

    For declaring players... well umm, you don't have one, so you can't exactly link it to the form. But basically you would do the same thing so. If you have an edit box that allows the user what kind of tree they want to chop, then n in your declare players you would say players[0].String1:=edit1.text;

  3. #3
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh, Ok..That seems easy enough , so I'd make the Array and just put in the edtUsername.text for declaring players?

    Now, How can I make it so when they click 'Create' it creates a new player and switches to him, or should I just get rid of that?

  4. #4
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Take a look at starblaster's powerskills in the free section. I know he does that in that script.

  5. #5
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, I read it. It uses stuff like SetArrayLength to +1 and etc..=], should be able to do this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Forms
    By marre in forum OSR Help
    Replies: 2
    Last Post: 12-19-2007, 07:53 PM
  2. Need help with forms!
    By Da Der Der in forum OSR Help
    Replies: 2
    Last Post: 01-14-2007, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •