Results 1 to 3 of 3

Thread: Script Needs Enhancing

  1. #1
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Script Needs Enhancing

    Well, here's the script to begin with:
    SCAR Code:
    program New;
    {.include SRL\SRL\Misc\Smart.scar}
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Reflection\Reflection.scar}

    var
      x, y, i, z: integer;
      Tiles: TPointArray;
    procedure DeclarePlayers;
    begin
      CurrentPlayer := 0;
      NumberOfPlayers(1);

      Players[0].Name := 'Meaniebutt7';
      Players[0].Nick := 'eani';
      Players[0].PAss := 'icanmine2';
      Players[0].Active := True;
    end;

    procedure SetupTiles;
    begin
      SetLength(Tiles, 11);
      Tiles[0] := Point(3227, 3148);
      Tiles[1] := Point(3238, 3158);
      Tiles[2] := Point(3238, 3171);
      Tiles[3] := Point(3244, 3183);
      Tiles[4] := Point(3243, 3197);
      Tiles[5] := Point(3235, 3206);
      Tiles[6] := Point(3235, 3215);
      Tiles[7] := Point(3222, 3219);
      Tiles[8] := Point(3215, 3212);
      Tiles[9] := Point(3205, 3209);
      Tiles[10] := Point(3207, 3219);
    end;

    //Climbs lumby stairs.
    procedure ClimbStairs;
    var Stairs: TPointArray;
    begin
      x := mscx;
      y := mscy;
      FindColorsSpiralTolerance(x, y, Stairs, 4347235, msx1, msy1, msx2, msy2, 5);
      for i := 0 to High(Stairs) do
      begin
        Mouse(Stairs[i].x, Stairs[i].y, 1, 1, False);
        Wait(1000);
        if ChooseOption('limb-up') then
        Exit;
      end;
    end;
       

    //Walks from lumby mine to bank
    procedure Setup;
    begin
      DeclarePlayers;
      SmartSetupEx(113, True, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupTiles;
      LoginPlayer;
      WriteLn(IntToStr(GetMyPos.x) + ' ' + IntToStr(GetMyPos.y));
      z := High(Tiles)-1;
      for i := 0 to z do
        WalkToTile(Tiles[i], 1, 0);
      ClimbStairs;
      Wait(1250);
      ClimbStairs;
      Wait(1250);
      z := High(Tiles)
      WalkToTile(Tiles[z], 1, 0);
      //WriteLn('Tiles[ ] := Point(' + IntToStr(GetMyPos.x) + ', ' + IntToStr(GetMyPos.y) + ');');
    end;

    begin
    Setup;
    end.

    How can I make it better?
    What can be done to make it more efficient?

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Well, you can not leave account information in your scripts first off. Other than that, there's not too much other than maybe checking for uptext when you're trying to climb the stairs.
    :-)

  3. #3
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol. It's not the actualy account information..

    Only the first and last letter/number of everything are correct.

    ED: Enhanced:
    SCAR Code:
    program New;
    {.include SRL\SRL\Misc\Smart.scar}
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Reflection\Reflection.scar}

    var
      x, y, i, z: integer;
      Tiles: TPointArray;
    procedure DeclarePlayers;
    begin
      CurrentPlayer := 0;
      NumberOfPlayers(1);

      Players[0].Name := 'Meaniebutt7';
      Players[0].Nick := 'eani';
      Players[0].PAss := 'icanmine2';
      Players[0].Active := True;
    end;

    procedure SetupTiles;
    begin
      SetLength(Tiles, 11);
      Tiles[0] := Point(3227, 3148);
      Tiles[1] := Point(3238, 3158);
      Tiles[2] := Point(3238, 3171);
      Tiles[3] := Point(3244, 3183);
      Tiles[4] := Point(3243, 3197);
      Tiles[5] := Point(3235, 3206);
      Tiles[6] := Point(3235, 3215);
      Tiles[7] := Point(3222, 3219);
      Tiles[8] := Point(3215, 3212);
      Tiles[9] := Point(3205, 3209);
      Tiles[10] := Point(3207, 3219);
    end;

    procedure ClimbStairs;
    var Stairs: TPointArray;
    begin
      x := mscx;
      y := mscy;
      FindColorsSpiralTolerance(x, y, Stairs, 4347235, msx1, msy1, msx2, msy2, 5);
      for i := 0 to High(Stairs) do
      begin
        Mouse(Stairs[i].x, Stairs[i].y, 1, 1, False);
        Wait(1000);
        if ChooseOption('limb-up') then
        Exit;
      end;
    end;
       


    procedure Setup;
    begin
      DeclarePlayers;
      SmartSetupEx(113, True, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupTiles;
      LoginPlayer;
      WriteLn(IntToStr(GetMyPos.x) + ' ' + IntToStr(GetMyPos.y));
      z := High(Tiles)-1;
      for i := 0 to z do
        WalkToTile(Tiles[i], 1, 0);
      ClimbStairs;
      Wait(1250);
      ClimbStairs;
      Wait(1250);
      z := High(Tiles)
      WalkToTile(Tiles[z], 1, 0);
      //WriteLn('Tiles[ ] := Point(' + IntToStr(GetMyPos.x) + ', ' + IntToStr(GetMyPos.y) + ');');
    end;

    begin
    Setup;
    end.

    ED2: Further enhancing:
    SCAR Code:
    program New;
    {.include SRL\SRL\Misc\Smart.scar}
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Reflection\Reflection.scar}

    var
      x, y, i: integer;
      Tiles: TPointArray;
    procedure DeclarePlayers;
    begin
      CurrentPlayer := 0;
      NumberOfPlayers(1);

      Players[0].Name := 'Meaniebutt7';
      Players[0].Nick := 'eani';
      Players[0].PAss := 'icanmine2';
      Players[0].Active := True;
    end;

    procedure WritePos;
    begin
      WriteLn('Current position: x:=' + IntToStr(GetMyPos.x) + '/y:=' + IntToStr(GetMyPos.y) + '.');
    end;

    procedure SetupTiles;
    begin
      SetLength(Tiles, 11);
      Tiles := [Point(3227, 3148), Point(3238, 3158), Point(3238, 3171), Point(3244, 3183),
                Point(3243, 3197), Point(3235, 3206), Point(3235, 3215), Point(3222, 3219),
                Point(3215, 3212), Point(3205, 3209), Point(3207, 3219)];
    end;

    function ClimbStairs : boolean;
    var Stairs: TPointArray;
    begin
      x := mscx;
      y := mscy;
      FindColorsSpiralTolerance(x, y, Stairs, 4347235, msx1, msy1, msx2, msy2, 5);
      for i := 0 to High(Stairs) do
        begin
          MMouse(Stairs[i].x, Stairs[i].y, 1, 1);
          Wait(1000);
          if IsUpText('taircase') then
            begin
              Result := True;
              Exit;
            end;
        end;
    end;
       
    function Walk: boolean;
    var BeforeLast, HighTile: Integer;
    begin
      WritePos;
      BeforeLast := High(Tiles)-1;
      for i := 0 to BeforeLast do
        begin
          WalkToTile(Tiles[i], 1, 0);
          Flag;
          WritePos;
        end;
      if ClimbStairs then
        begin
          Wait(1250 + Random(750));
          ClimbStairs;
        end;
      HighTile := High(Tiles);
      WalkToTile(Tiles[HighTile], 1, 0);
      if FindBank('lumbridge') then
        begin
          WritePos;
          Result := True;
          Exit;
        end;
    end;

    procedure Setup;
    begin
      DeclarePlayers;
      SmartSetupEx(113, True, True, False);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      SetupTiles;
      LoginPlayer;
      if Walk then
        WriteLn('Completed successfully!');
    end;

    begin
    Setup;
    end.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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