Results 1 to 6 of 6

Thread: Gnome Agility Trainer

  1. #1
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Gnome Agility Trainer

    If someone could make a basic gnome agility trainer, update Nadeem's one, or update the mouse trainer that would be great

    Nadeem's: http://www.villavu.com/forum/showthread.php?t=43749

    Mouse Trainer script: http://www.villavu.com/forum/showthread.php?t=19677
    Last edited by kevin0095; 08-21-2009 at 10:04 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    Give me a members account and Ill give it a go.
    Jus' Lurkin'

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i had one half done kinda if anyone wants to finish it (it wasnt great but it was o.k)

  4. #4
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If someone wants to make one, I can lend them a members account for a day or so to test it out.

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program AgilityRunner;
    {.include srl/srl.scar}

    type
      Rinfo = Record
        position, failed, success: string;
        aStrArr: TStringArray;
        col, tol, x, y: integer;
        hue, sat: Extended;
      end;
      Pinfo = Record
        f, a: integer;
        xp, lvl: integer;
      end;

    var Progress: array of Pinfo; GnC: array of Rinfo; down: Boolean;

    Function GetMMPoints(x, y, color, width, height, tolerance: Integer): TpointArray;
    var tpa: TpointArray; atpa: T2DpointArray; l, i, p: Integer;
    begin
      FindColorsSpiralTolerance(x, y, tpa, color, MMx1, MMy1, MMx2, MMy2, tolerance);
      Atpa := TPAtoATPAEx(Tpa, width, height);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 5 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      if Length(result) = 0 then Exit;
      for i := 0 to High(Result) do
        if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
        if p = 0 then SetArrayLength(Result, 0);
      WriteLn('Found: '+IntToStr(l)+' Result(s)');
    end;

    Function ClickMMpoint(tpa: TpointArray; xmod, ymod: Integer): Boolean;
    var i: integer;
    begin
      for i := 0 to High(tpa) do
      begin
        WriteLn('Current Point at: ('+IntToStr(Tpa[i].x)+', '+IntToStr(tpa[i].y)+');');
        if not rs_OnMiniMap(tpa[i].x, tpa[i].y) then Continue;
        Mouse(tpa[i].x+xmod, tpa[i].y+ymod, 5, 5, True);
        Wait(150+random(200));
        if FlagPresent then
        begin
          Result := True;
          Flag;
          Break;
        end else
        Continue;
      end;
      wait(500+random(750));
    end;

    Function DeturmineWalkColor: Integer;
    begin
      Tpa := GetMMPoints(MMx1, MMy1, 2447722, 10, 10, 25);
      sortTPAfrom(tpa, Point(575, 89));
      ClickMMPoint(Tpa, 10, -12);
    end;

    Function CreateWalkingPoints(col: Integer): Integer;
    var MainPoint: TDTMPointDef; dtmSubPoints: Array [1..4] of TDTMPointDef; TempTDTM: TDTM; i: Integer;
    begin
      with MainPoint do
      begin
        x := 840;
        y := 248;
        AreaSize := 2;
        AreaShape := 0;
        Color := 15527148;
        Tolerance := 422;
      end;
      dtmSubPoints[1].x := 832;
      dtmSubPoints[1].y := 275;
      dtmSubPoints[2].x := 848;
      dtmSubPoints[2].y := 275;
      dtmSubPoints[3].x := 847;
      dtmSubPoints[3].y := 256;
      dtmSubPoints[4].x := 832;
      dtmSubPoints[4].y := 256;

      for i := 1 to High(dtmSubPoints) do
      begin
        dtmSubPoints[i].Color := col;
        dtmSubPoints[i].Tolerance := 25;
        dtmSubPoints[i].AreaSize := 1;
      end;
      TempTDTM.MainPoint := MainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;

    Function ClickWalkingPoint: Boolean;
    var dtm, col, x, y: Integer;
    begin
      col := DeturmineWalkColor;
      if col = 0 then Exit;
      dtm := CreateWalkingPoints(col);
      Result := DTMRotated(dtm, x, y, MMx1, MMy1, MMcx+50, MMy2);
      FreeDtm(dtm);
      if not Result then Exit;
      WriteLn('Dtm located at: ('+IntToStr(x)+','+IntToStr(y)+')');
      Mouse(x, y-5, 5, 5, True);
      FFlag(0);
      Wait(750+random(300));
    end;
     
    Procedure CreateObjectRecord;
    begin
      SetArrayLength(GnC, 7);
      with GnC[0] do
      begin
        position := 'log';
        failed := '';
        success := 'afe';
        aStrArr := ['alk', 'og'];
        hue := 0.03;
        sat := 0.20;
        col := 668758;
        tol := 7;
      end;
      with GnC[1] do
      begin
        position := 'net';
        failed := '';
        success := 'ett';
        aStrArr := ['et', 'et'];
        hue := 0.04;
        sat := 0.16;
        col := 801892;
        tol := 10;
        y := MSy2;
      end;
      with GnC[2] do
      begin
        position := 'branch';
        failed := '';
        success := 'bove';
        aStrArr := ['anch', 'limb'];
        hue := 0.07;
        sat := 1.96;
        col := 2182241;
        tol := 6;
        y := MSy1;
      end;
      with GnC[3] do
      begin
        position := 'rope';
        failed := '';
        success := 'ross';
        aStrArr := ['ope', 'ope'];
        hue := 0.03;
        sat := 0.02;
        col := 5469841;
        tol := 75;
        x := 427;
      end;
      with GnC[4] do
      begin
        position := 'branch';
        failed := '';
        success := 'ound';
        aStrArr := ['anch', 'limb'];
        hue := 0.07;
        sat := 1.96;
        col := 2182241;
        tol := 6;
        y := 183;
        x := 362;
      end;
      with GnC[5] do
      begin
        position := 'net';
        failed := '';
        success := 'ett';
        aStrArr := ['et', 'et'];
        hue := 0.04;
        sat := 0.16;
        col := 801892;
        tol := 15;
        y := MSy1;
      end;
      with GnC[6] do
      begin
        position := 'pipe';
        failed := 'sed';
        success := 'ueeze';
        aStrArr := ['ipe', 'ipe'];
        hue := 0.11;
        sat := 0.06;
        col := 6447979;
        tol := 19;
      end;
    end;

    Function FindRopePoints: TpointArray;
    var tpa: TpointArray; atpa: T2DPointArray; l, i, cts: Integer;
    begin
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      SetColorSpeed2Modifiers(GnC[3].hue, GnC[3].sat);
      FindColorsSpiralTolerance(430, 148, tpa, GnC[3].col, 420, 148, 480, 176, GnC[3].tol);
      SortTpaFrom(tpa, Point(GnC[3].x, GnC[3].y));
      Atpa := SplitTPAEx(Tpa, 1, 1);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 0 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      ColorToleranceSpeed(cts);
      SetColorSpeed2Modifiers(0.2, 0.2);
      WriteLn('Found: '+IntToStr(l)+' Point(s)') {else Inc(Progress[CurrentPlayer].f)};
    end;

    procedure FilterPointsBlackEx(var TPA : TPointArray); // ty Da0wner
    var
      i, h : integer;
      TIA : TIntegerArray;
    begin
      TIA := GetColors(TPA);
      h := high(TIA);
      for i := 0 to h do
        if TIA[i] = 0 then
        begin
          Swap(TPA[i], TPA[h]);
          SetArrayLength(TPA, h);
          h := high(TPA);
        end;
    end;

    procedure FilterPointBlack(var tpa :TPointArray);
    begin
      FilterPointsBlackEx(TPA);
    end;

    Function FindObjPoints(Index: Integer): TpointArray;
    var tpa: TpointArray; atpa: T2DPointArray; l, i, cts: Integer;
    begin
      if GnC[index].x = 0 then GnC[index].x := MScx;
      if GnC[index].y = 0 then GnC[index].y := MScy;
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(GnC[index].hue, GnC[index].sat);
      FindColorsSpiralTolerance(MScx, MScy, tpa, GnC[index].col, MSx1, MSy1, MSx2, MSy2, GnC[index].tol);
      SortTpaFrom(tpa, Point(GnC[index].x, GnC[index].y));
      Atpa := TpatoAtpaEx(Tpa, 10, 10);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 5 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      ColorToleranceSpeed(cts);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if (l > 0) then WriteLn('Found: '+IntToStr(l)+' Point(s)') {else Inc(Progress[CurrentPlayer].f)};
    end;

    Function ClickMSpoint(Index: Integer; tpa: TpointArray; StrArr: TStringArray; RClick: Boolean): Boolean;
    var i, h: integer; Bool: Boolean;
    begin
      //h := 5;
      //if Length(tpa) < 5 then Exit;
      for i := 0 to high(tpa) do
      begin
        if Index = 3 then MMouse(tpa[i].x, tpa[i].y, 0, 0) else MMouse(tpa[i].x, tpa[i].y, 3, 3);
        Wait(350+random(200));
        If IsUpText(StrArr[0]) then
        begin
          GetMousePos(GnC[index].x, GnC[index].y);
          Wait(Random(100));
          bool := random(4) <> 1;
          if Rclick then Bool := False;
          Mouse(GnC[index].x, GnC[index].y, 0, 0, Bool);
          Wait(100+random(150));
          ChooseOption(StrArr[1]);
          Wait(100+random(100));
          Result := True;
          Exit;
        end else
        Continue;
      end;
    end;

    Function CompleteObstacle(Index: Integer): Boolean;
    var i, a, attempts, t: Integer; tpa: TpointArray; Bool, ReRun, AngleSet: Boolean;
    begin
      if not LoggedIn then Exit;
      i := index;
      Status(GnC[i].Position);
      WriteLn(GnC[i].Position);
      if i = 3 then tpa := FindRopePoints else tpa := FindObjPoints(i);
      if i = 2 then Bool := True;
      if Length(tpa) <= 0 then CompleteObstacle(i);
      ClickMSpoint(i, tpa, GnC[i].aStrArr, Bool);
      a := Getsystemtime;
      while not FindBlackChatMessage(GnC[i].Success) do
      begin
        if FindBlackChatMessage(GnC[i].Failed) or (GetSystemTime-a >= 25000) then
        begin
          ReRun := True;
          Break;
        end;
        wait(150+random(200));
        Down := False;
      end;
      if not ReRun then
      begin
        WriteLn('Completed. Object: ['+IntToStr(i)+']; Continuing.');
        if AngleSet then
        begin
          SetAngle(True);
          AngleSet := False;
        end;
        Result := True;
        if i = 3 then Wait(4000+random(1000)) else wait(2550+random(750));
        Exit;
      end;
      WriteLn('Failed. Object: ['+IntToStr(i)+']; Reinitiating.');
      if i = 4 then
      begin
        SetAngle(False);
        AngleSet := True;
      end;
      inc(Attempts);
      WriteLn('Attempted to Solve Object: ['+IntToStr(i)+']: '+IntToStr(attempts)+' times.');
      if Attempts > 1 then
      begin
        Result := False;
        Exit;
      end;
      CompleteObstacle(Index);
    end;

    Function ObstacleLoop(Index: Integer): Boolean;
    begin
      case Index of
        0..4, 6: Result := CompleteObstacle(Index);
        5:
        begin
          Result := CompleteObstacle(Index);
          if not Result then
          begin
            Mouse(MMcx, MMcy-10, 5, 5, True);
            Flag;
            Result := CompleteObstacle(Index);
          end;
        end;
      end;
    end;

    Function Mainloop: Boolean;
    var i: Integer;
    begin
      for i := 0 to 6 do
        Result := ObstacleLoop(i);
    end;

    begin
      SetUpSRL;
      ActivateClient;
      CreateObjectRecord;
      DeturmineWalkColor;
      MainLoop;
    end.

    this is what I had done, its by no means perfect, and some stuff may be buggy. I havent touched it in about a month and a half now, but if anyone wishes to use parts of it feel free.

  6. #6
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    I will give the mouse Agility a go

    T~M

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
  •