Results 1 to 3 of 3

Thread: Help me get this agility rooftop script working! ^u^

  1. #1
    Join Date
    Apr 2014
    Posts
    323
    Mentioned
    0 Post(s)
    Quoted
    131 Post(s)

    Default Help me get this agility rooftop script working! ^u^

    Simba Code:
    program AIOAgility;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SRL-OSR\SRL\misc\SmartGraphics.simba}
    {$I SRL-OSR/SRL/Reflection/Reflection.simba}

    type
      TCourseObject = record
        Tile, EndTile: TPoint;
        Plane, X, Y, Z: Integer;
        UpText: String;
      end;

      TCourseObjectArray = Array of TCourseObject;

      TCourse = record
        Name: String;
        StartPlane: Integer;
        CourseObjects: TCourseObjectArray;
      end;

      TCourseArray = Array of TCourse;

    var
      Courses: TCourseArray;
      CurrentCourse: TCourse;
      AgilityDrops: TIntegerArray;
      Laps, StartExp, StartLvl: Integer;

    const
      COURSE_CANIFIS_ROOFTOPS = 0;
      COURSE_FALADOR_ROOFTOPS = 1;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';//Username
      Players[0].Pass := '';//Password
      Players[0].Nick := ''; //Nickname
      Players[0].Pin := ''; //Pin
      Players[0].Strings[0] := 'Canifis Rooftops';
      Players[0].LampSkill := SKILL_AGILITY;
      Players[0].Active := True;
    end;

    function GetCourseByName(Name: String): TCourse;
    var
      I: Integer;
    begin
      for I := 0 to High(Courses) do
        if (Courses[I].Name = Name) then
        begin
          Result := Courses[I];
          Exit;
        end;
    end;

    function R_TileOnMS(tile:TPoint):boolean;
    begin
      result := PointInBox(R_TileToMS(tile), MSBox);
    end;

    function CourseObject(Tile, EndTile: TPoint; Plane, X, Y, Z: Integer; UpText: String): TCourseObject;
    begin
      Result.Tile := Tile;
      Result.EndTile := EndTile;
      Result.Plane := Plane;
      Result.X := X;
      Result.Y := Y;
      Result.Z := Z;
      Result.UpText := UpText;
    end;

    function Course(Name: String; StartPlane: Integer; CourseObjects: TCourseObjectArray): TCourse;
    begin
      Result.Name := Name;
      Result.StartPlane := StartPlane;
      Result.CourseObjects := CourseObjects;
    end;

    procedure SetupScript;
    begin
      AgilityDrops := [11849];
      Courses := [
        Course('Canifis Rooftops', 0, [
          CourseObject(Point(3508, 3489), Point(3506, 3492), 0, 0, 0, 20, 'Climb Tall tree'),
          CourseObject(Point(3505, 3497), Point(3502, 3504), 2, 0, 0, 0, 'Jump Gap'),
          CourseObject(Point(3497, 3504), Point(3492, 3504), 2, 0, 0, 0, 'Jump Gap'),
          CourseObject(Point(3486, 3499), Point(3479, 3499), 2, 0, 0, 0, 'Jump Gap'),
          CourseObject(Point(3479, 3492), Point(3478, 3486), 3, 0, 0, 0, 'Jump Gap'),
          CourseObject(Point(3480, 3483), Point(3489, 3476), 2, 0, 0, -5, 'Vault Pole-vault'),
          CourseObject(Point(3503, 3476), Point(3510, 3476), 3, 0, 0, 0, 'Jump Gap'),
          CourseObject(Point(3510, 3483), Point(3510, 3485), 2, 0, 0, 0, 'Jump Gap')
        ]),
        Course('Falador Rooftops', 0, [
          CourseObject(Point(3036, 3341), Point(3036, 3342), 0, 0, 64, 120, 'Climb Rough wall'),
          CourseObject(Point(3040, 3343), Point(3047, 3344), 3, 50, 0, 0, 'Cross Tightrope'),
          CourseObject(Point(3050, 3349), Point(3050, 3357), 3, -60, 30, -30, 'Cross Hand holds'),
          CourseObject(Point(3048, 3358), Point(3048, 3361), 3, -32, 0, 0, 'Jump Gap'),
          CourseObject(Point(3045, 3361), Point(3041, 3361), 3, -32, 0, 0, 'Jump Gap'),
          CourseObject(Point(3034, 3362), Point(3028, 3354), 3, -50, -64, 0, 'Cross Tightrope'),
          CourseObject(Point(3026, 3353), Point(3020, 3353), 3, -50, 0, 0, 'Cross Tightrope'),
          CourseObject(Point(3018, 3353), Point(3018, 3349), 3, -50, 0, 0, 'Jump Gap'),
          CourseObject(Point(3016, 3345), Point(3014, 3345), 3, 0, 0, 0, 'Jump Ledge'),
          CourseObject(Point(3012, 3343), Point(3013, 3342), 3, 0, 32, 0, 'Jump Ledge'),
          CourseObject(Point(3013, 3335), Point(3012, 3333), 3, 0, -32, 0, 'Jump Ledge'),
          CourseObject(Point(3018, 3333), Point(3019, 3333), 3, -32, 0, 0, 'Jump Ledge'),
          CourseObject(Point(3023, 3333), Point(3029, 3333), 3, 0, 0, 0, 'Jump Edge')
        ])
      ];
    end;

    procedure SetupPlayer;
    begin
      StartExp := R_GetSkillExp(SKILL_AGILITY);
      StartLvl := R_GetSkillLevel(SKILL_AGILITY);
    end;

    procedure RandomCamera;
    begin
      CompassMovement(0, 180, False);
    end;

    procedure ClickCourseObject(CObject: TCourseObject);
    var
      MS: TPoint;
    begin
      if (not R_TileOnMS(CObject.Tile)) then begin
        RandomCamera;
        ClickCourseObject(CObject);
        Exit;
      end;
      MS := R_TileOffsetToMS(CObject.Tile, CObject.X, CObject.Y, CObject.Z);
      MMouse(MS.X, MS.Y, 2, 2);
      Sleep(50 + Random(50));
      if (R_IsUpText(CObject.UpText)) then
        ClickMouse2(Mouse_Left)
      else begin
        if (R_IsUpText('Walk here')) then begin
          RandomCamera;
          ClickCourseObject(CObject);
          Exit;
        end;
        ClickMouse2(Mouse_Right);
        if (not R_WaitChooseOption(CObject.UpText, 1000)) then begin
          RandomCamera;
          ClickCourseObject(CObject);
          Exit;
        end;
      end;
    end;

    function OnePlaneCourse(Course: TCourse): Boolean;
    var
      I, N: Integer;
    begin
      for I := 0 to High(Course.CourseObjects) do
        if (Course.CourseObjects[I].Plane = Course.CourseObjects[0].Plane) then
          Inc(N);
      Result := (N = High(Course.CourseObjects) + 1);
    end;

    procedure LootAgilityDrops;
    var
      Loots: TGroundItemArray;
      MS: TPoint;
      I: Integer;
    begin
      Loots := R_GetGroundItemsDistance(16);
      for I := 0 to High(Loots) do begin
        if (InIntArray(AgilityDrops, Loots[I].ID)) then begin
          Sleep(1000);
          if (not R_TileOnMS(Loots[I].Tile)) then begin
            R_BlindWalk(Loots[I].Tile);
            Flag;
            Sleep(250 + Random(250));
          end;
          MS := R_TileToMS(Loots[I].Tile);
          MMouse(MS.X, MS.Y, 2, 2);
          Sleep(50 + Random(50));
          ClickMouse2(Mouse_Left);
          Sleep(500);
          Flag;
          Sleep(750 + Random(250));
        end;
      end;
    end;

    procedure ProgressReport;
    var
      ExpGained, ExpGainedPerHour, LapsPerHour, LevelsGained: Integer;
    begin
      ExpGained := R_GetSkillExp(SKILL_AGILITY) - StartExp;
      ExpGainedPerHour := Round((ExpGained * 3600) / (GetTimeRunning / 1000));
      LapsPerHour := Round((Laps * 3600) / (GetTimeRunning / 1000));
      LevelsGained := R_GetSkillLevel(SKILL_AGILITY) - StartLvl;
      Writeln('');
      Writeln('AIO Agility - By Frement');
      Writeln(' - Time Running: ' + TimeRunning);
      Writeln(' - Course: ' + CurrentCourse.Name);
      Writeln(' - Laps: ' + ToStr(Laps) + ' (' + ToStr(LapsPerHour) + '/H)');
      Writeln(' - Experience Gained: ' + ToStr(ExpGained) + ' (' + ToStr(ExpGainedPerHour) + '/H)');
      Writeln(' - Levels Gained: ' + ToStr(LevelsGained) + ' (' + ToStr(R_GetSkillLevel(SKILL_AGILITY)) + ')');
    end;

    procedure DoCourse(Course: TCourse);
    var
      I, Next, Timer: Integer;
    begin
      for I := 0 to High(Course.CourseObjects) do begin
        R_FindNormalRandoms;
        SolveBox;
        while (not R_NearTile(Course.CourseObjects[I].Tile, 3)) do // and (not R_TileOnMS(Course.CourseObjects[I].Tile)) do
        begin
          R_BlindWalk(Point(Course.CourseObjects[I].Tile.X, Course.CourseObjects[I].Tile.Y - 2));
          while (R_IsWalking) do
            Sleep(250);
        end;
        Sleep(750 + Random(250));
        ClickCourseObject(Course.CourseObjects[I]);
        Sleep(500 + Random(250));
        while (R_IsWalking) do
            Sleep(250);
        ProgressReport;
        if (I = High(Course.CourseObjects)) then
          Next := 0
        else
          Next := I + 1;
        if (Course.CourseObjects[I].EndTile <> Point(0, 0)) then
          if (Course.CourseObjects[I].Plane = Course.CourseObjects[Next].Plane) then begin
            while (not R_NearTile(Course.CourseObjects[I].Tile, 2)) do
              Sleep(250 + Random(250));
            while (R_IsWalking) do
              Sleep(1000 + Random(500));
          end else begin
            while (R_GetPlane = Course.CourseObjects[I].Plane) do
              Sleep(1000 + Random(500));
          end
        else begin
          MarkTime(Timer);
          while (R_GetTileGlobal <> Course.CourseObjects[I].EndTile) do begin
            Sleep(500);
            if (TimeFromMark(Timer) > 10000) then begin
              ClickCourseObject(Course.CourseObjects[I]);
              while (R_NearTile(Course.CourseObjects[I].EndTile, 2)) do
                Sleep(500);
              Break;
            end;
          end;
        end;
        Sleep(1000 + Random(250));
        if (not OnePlaneCourse(Course)) then
          if (R_GetPlane = Course.StartPlane) and (not (I = High(Course.CourseObjects))) then
            Exit;
        LootAgilityDrops;
      end;
      Inc(Laps);
    end;

    begin
      DeclarePlayers;
      SetupSRL;
      SetupReflection;
      //Writeln(R_GetTileGlobal);
      //Writeln(R_GetPlane);
      //TerminateScript;
      SetupScript;
      SetupPlayer;
      CurrentCourse := GetCourseByName(Players[CurrentPlayer].Strings[0]);
      repeat
        DoCourse(CurrentCourse);
        ProgressReport;
      until(False);
    end.

    Frement made this script, I did not. It should run without errors if you have reflection correctly installed.
    The problem atm is it does the first two obstacles (canafis) but just takes a nap on the third. It literally just sits there. I ran debug to try and find what it was doing. Here is screenshot.


  2. #2
    Join Date
    Apr 2014
    Posts
    323
    Mentioned
    0 Post(s)
    Quoted
    131 Post(s)

    Default

    my suggestion would to go run it at canafis so that anyone who is interested can see what it's doing.

  3. #3
    Join Date
    Apr 2014
    Posts
    323
    Mentioned
    0 Post(s)
    Quoted
    131 Post(s)

    Default

    bump

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
  •