Page 6 of 10 FirstFirst ... 45678 ... LastLast
Results 126 to 150 of 239

Thread: Randoms Development

  1. #126
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Ah might be, wasn't watching SMART, was improving my thiever script and noticed debug after a few min so I tabbed in to see him attacking me

    I'm still using my text as I'm too lazy to update manually to Simba 993, thats probably it works fine on the others and the thieving was working fine and I used the same thing,

    Could be a 1 off, but spmething to maybe keep an eye on
    Well the uptext is different from the other talking randoms - that's why there is the part about the guard in there. I noticed it didn't detect it with just one portion of uptext so I added some more in the array, but it still might not be detecting it. Would probably need it to print out the uptext to see what it is seeing

  2. #127
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Also are there any thoughts on better combat random detection? Right now it just searches for the fight bar right around your char and if it finds it, it runs away and back. The only bad thing is that if another player gets attacked on the square next to you/on top of you, it will think you are in combat and run away, which could become a pain. I was thinking maybe have an hp checker when it detects the attack bar. The checker would work by if you aren't at full health on the stats tab, then run away?

  3. #128
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Also are there any thoughts on better combat random detection? Right now it just searches for the fight bar right around your char and if it finds it, it runs away and back. The only bad thing is that if another player gets attacked on the square next to you/on top of you, it will think you are in combat and run away, which could become a pain. I was thinking maybe have an hp checker when it detects the attack bar. The checker would work by if you aren't at full health on the stats tab, then run away?
    if you aren't at full health on the stats tab, then run away?
    Sounds good

    current hp = GetSkillInfo('hitpoints', True);
    max hp = GetSkillInfo('hitpoints', False);

    if current hp < max hp then run;

    should work

    but if your max lvl (99 def) can you always get hit 0 ?


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  4. #129
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    @Ashaman88

    Having one issue with this, I can't find any way to reliably move back to the center of the white box MM because of the stupid MM shift rotation,

    I've tried RotatedDTM, Coh3n's TPA box thing, can't think of anything that will work every time :/ any ideas? I'm guna give up for today and go watch some TV,

    Bitmaps on the signs has a 90% + success rate if I can just get to the starting center again haha



    Simba Code:
    (*
    Drill Demon
    ===========

    Stores all the routines to solve the Drill Demon random.  None of these routines
    should be used throughout scripts.  They only need to be called in SRL's random
    detection methods.

    This solver uses BMPs and DTMs to locate the signs
    to solve the Drill Demon (Sergeant Damien) random.

    Original Author : DannyRS
    Edits Made By   :

    *)


    procedure DD_Message(Message: string);
    begin
      addToSRLLog('[DemonDrill Random] ' + Message);
    end;

    function DD_Detect(): boolean;
    begin
      if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
        Result := (GetMusic = 'CorPoral Punisbment');
    end;

    (**
     * Author: Coh3n
     * Description: Returns a TBox of the exercise area on the minimap. It finds the
     * distance from the player to each side of the exercise area. Saves the
     * distance and points in arrays. It then uses those arrays to calculate the
     * top left and bottom right corners of the exercise area.
     *)

    function DD_GetExerciseArea(var exerciseArea: TBox): boolean;
    var
      i, c, t, w, h, distFound: integer;
      dist: array[0..3] of integer;
      area: array[0..3] of TBox;
      tpa: array[0..3] of TPoint;
    begin
      if (not loggedIn()) then
        exit;

      t := (getSystemTime + 15000);

      repeat
        inc(c);

        // search areas for each direction (only one pixel at a time)
        area[0] := intToBox(MMCX, MMCY - 1 - c, MMCX, MMCY - 1 - c); // north
        area[1] := intToBox(MMCX + 1 + c, MMCY, MMCX + 1 + c, MMCY); // east
        area[2] := intToBox(MMCX, MMCY + 1 + c, MMCX, MMCY + 1 + c); // south
        area[3] := intToBox(MMCX - 1 - c, MMCY, MMCX - 1 - c, MMCY); // west

        //Above is buggy as hell atm :/ - Danny
        if ((MMCY - 1 - c) > MMY1) or ((MMCX - 1 - c) > MMX1) or
           ((MMCY + 1 + c) > MMY2) or ((MMCX + 1 + c) > MMX2) then
          Exit;

        // loop through each area (i.e. direction) to get the distance from the player to the fence on the MM
        for i := 0 to high(area) do
          if (dist[i] = 0) then
            // the white color of the fence
            if (findColorTolerance(tpa[i].x, tpa[i].y, 15068652, area[i].x1, area[i].y1, area[i].x2, area[i].y2, 25)) then
            begin
              dist[i] := distance(tpa[i].x, tpa[i].y, MMCX, MMCY);
              inc(distFound);
            end;

        // if all 4 distances are found
        if (distFound = 4) then
        begin
          // calculate the top left and bottom right of the exercise box
          exerciseArea.x1 := tpa[3].x;
          exerciseArea.y1 := tpa[3].y - dist[0];
          exerciseArea.x2 := tpa[1].x;
          exerciseArea.y2 := tpa[1].y + dist[2];

          //SMART_DrawBox(exerciseArea);

          w := (exerciseArea.x2 - exerciseArea.x1);
          h := (exerciseArea.y2 - exerciseArea.y1);
          //writeln('w: '+toStr(w)+', h: '+toStr(h));

          // sometimes the Drill Demon is standing right inline with the player, causing the next white line to be found on the edge of the MM
          result := (inRange(35, w - 7, w + 7) and inRange(20, h - 5, h + 5));
        end;

      until(result or (getSystemTime > t));
    end;

    function DD_ResetPosition: boolean;
    var
      exerciseArea: TBox;
      p: TPoint;
    begin
      if (not loggedIn()) then
        exit;

      if (DD_GetExerciseArea(exerciseArea)) then
      begin
        p := middleBox(exerciseArea);
        mouse(p.x, p.y + 5, 2, 2, mouse_Left);
        Result := True;
      end;
    end;

    function DD_TalkingToDemon: Boolean;
    begin
      Result := (Trim(GetNPCChatName) = 'SergeantDamien');
    end;

    function DD_TalkDemon: Boolean;
    var
      DemonTPA: TPointArray;
      DemonATPA: T2DPointArray;
      x, y, i: Integer;
    begin
      Result := False;

      if (DD_TalkingToDemon) then
      begin
        Result := True;
        Exit;
      end;

      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.15, 1.61);
      FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
      SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
      SortATPASize(DemonATPA, True);

      if (Length(DemonATPA) < 1) then Exit;

      for i := 0 to High(DemonATPA) do
      begin
        if (Length(DemonATPA[i]) < 50) then Continue;
        MiddleTPAEx(DemonATPA[i], x, y);
        MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
        ClickMouse2(mouse_right);
        if (ChooseOptionMulti(['Talk','alk-to'])) then
        begin
          if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
          begin
            DD_Message('[DD_TalkDemon] Talked to demon');
            Result := True;
            Exit;
          end else
            DD_Message('[DD_TalkDemon] Failed to Talked to demon');
        end;
      end;
    end;

    function DD_GetSigns: TBoxArray;
    var
      ESignsTPA: TPointArray;
      ESignsATPA: T2DPointArray;
      SignsSorted: Boolean;
      i: Integer;
    begin
      SetColorToleranceSpeed(1);
      FindColors(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2);
      SplitTPAExWrap(ESignsTPA, 20, 30, ESignsATPA);

      repeat
        SignsSorted := True;
        for i := 0 to High(ESignsATPA) do
        begin
          if (Length(ESignsATPA[i]) < 5) then
          begin
            DeleteValueInATPA(ESignsATPA,i);
            SignsSorted := False;
            Break;
          end;
        end;
      until (SignsSorted);

      SetLength(Result, Length(ESignsATPA));

      for i := 0 to high(ESignsATPA) do
      begin
        Result[i] := GetTPABounds(ESignsATPA[i]);
      end;
    end;

    function DD_FindSign(WhichSign: String): TPoint;
    var
      SB: TBoxArray;
      x, y, i, SBMP: Integer;
      Saccuracy: Extended;
    begin
      Result := Point(-1, -1);

      SB := DD_GetSigns;

      SetColorToleranceSpeed(1);
      SetToleranceSpeed2Modifiers(0.02, 0.02);

      case LowerCase(WhichSign) of
        'jog':       SBMP := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
                            'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlIrVKl' +
                            'rLNxk4tUDAIc3Qs8=');
        'starjumps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
                            '34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdLHOuR' +
                            'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
        'situps':    SBMP := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
                            '473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnqCGtE' +
                            'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I1mHa' +
                            'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
        'pushups':   SBMP := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
                            'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2jaWg' +
                            'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0AjuAl' +
                            '9Q==');
      end;

      for i := 0 to High(SB) do
      begin
        if FindDeformedBitmapToleranceIn(SBMP, x, y, SB[i].X1-5, SB[i].Y1-5,
          SB[i].X2+5, SB[i].Y2+5, 2, 4, False, Saccuracy) then
          begin
            if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Break;
            Result := Point(x + 20, y + 7);
            Break;
          end;
      end;

      FreeBitmap(SBMP);
    end;

    function DD_Solve(): boolean;
    var
      p: TPoint;
      t, tmpCTS, MMoves: Integer;
      tmpHM, tmpSM: Extended;
      MatName: String;
      ClickedMat: Boolean;
    begin
      Result := False;

      if (not LoggedIn) then Exit;

      t := GetSystemTime;

      tmpCTS := GetColorToleranceSpeed;
      GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

      SetAngle(SRL_ANGLE_LOW);
      MakeCompass('N');

      repeat

        Result := TabExists(TAB_MAGIC);

        if (Result) then Exit;

        if (not DD_TalkDemon) then
        begin
          DD_ResetPosition;
          Continue;
        end;

        Wait(RandomRange(1200, 1600));

        case CountColor(0, MCX1, MCY1, MCX2, MCY2) of
          687,988 : MatName := 'jog';
          707     : MatName := 'starjumps';
          569     : MatName := 'situps';
          637,938 : MatName := 'pushups';
          else
          begin
            ClickToContinue;
            Continue;
          end;
        end;

        DD_Message('[DD_Solve] Walking to center');

        if (not DD_ResetPosition) then
        begin
          DD_Message('[ERROR] Failed to walk to center');
          Continue;
        end;

        DD_Message('[DD_Solve] Searching for sign : ' + MatName);

        p := DD_FindSign(MatName);

        if (p.x < 0) or (p.y < 0) then
        begin
          DD_Message('[ERROR] Failed to find sign : ' + MatName);
          Continue;
        end;

        ClickedMat:= False;
        MMoves := 0;

        DD_Message('[DD_Solve] Searching for matt : ' + MatName);

        repeat
          MMouse(p.x, p.y + 64, 40, 20);
          MMoves := MMoves + 1;
          Wait(RandomRange(90, 340));
          if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
          begin
            ClickMouse2(mouse_right);
            if (ChooseOptionMulti(['Use'])) then
            begin
              Wait(RandomRange(1200, 1500));
              if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
              begin
                DD_Message('[DD_Solve] Used Matt');
                ClickedMat := True;
                Break;
              end else
              begin
                DD_Message('[DD_Solve] Failed to Use Matt');
                Continue;
              end;
            end;
          end;
        until (ClickedMat) or (MMoves > 10);

      Result := TabExists(TAB_MAGIC);

      until (Result) or (GetSystemTime - t > 240000);

      if (not Result) then
      begin
        if (GetSystemTime - t > 240000) then
          DD_Message('[ERROR] DrillDemon solver timed out');
      end else
        Wait(RandomRange(1200, 1600));
    end;
    Last edited by DannyRS; 03-16-2013 at 11:43 PM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  5. #130
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    @Ashaman88

    Having one issue with this, I can't find any way to reliably move back to the center of the white box MM because of the stupid MM shift rotation,

    I've tried RotatedDTM, Coh3n's TPA box thing, can't think of anything that will work every time :/ any ideas? I'm guna give up for today and go watch some TV,

    Bitmaps on the signs has a 90% + success rate if I can just get to the starting center again haha



    Simba Code:
    (*
    Drill Demon
    ===========

    Stores all the routines to solve the Drill Demon random.  None of these routines
    should be used throughout scripts.  They only need to be called in SRL's random
    detection methods.

    This solver uses BMPs and DTMs to locate the signs
    to solve the Drill Demon (Sergeant Damien) random.

    Original Author : DannyRS
    Edits Made By   :

    *)


    procedure DD_Message(Message: string);
    begin
      addToSRLLog('[DemonDrill Random] ' + Message);
    end;

    function DD_Detect(): boolean;
    begin
      if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
        Result := (GetMusic = 'CorPoral Punisbment');
    end;

    (**
     * Author: Coh3n
     * Description: Returns a TBox of the exercise area on the minimap. It finds the
     * distance from the player to each side of the exercise area. Saves the
     * distance and points in arrays. It then uses those arrays to calculate the
     * top left and bottom right corners of the exercise area.
     *)

    function DD_GetExerciseArea(var exerciseArea: TBox): boolean;
    var
      i, c, t, w, h, distFound: integer;
      dist: array[0..3] of integer;
      area: array[0..3] of TBox;
      tpa: array[0..3] of TPoint;
    begin
      if (not loggedIn()) then
        exit;

      t := (getSystemTime + 15000);

      repeat
        inc(c);

        // search areas for each direction (only one pixel at a time)
        area[0] := intToBox(MMCX, MMCY - 1 - c, MMCX, MMCY - 1 - c); // north
        area[1] := intToBox(MMCX + 1 + c, MMCY, MMCX + 1 + c, MMCY); // east
        area[2] := intToBox(MMCX, MMCY + 1 + c, MMCX, MMCY + 1 + c); // south
        area[3] := intToBox(MMCX - 1 - c, MMCY, MMCX - 1 - c, MMCY); // west

        //Above is buggy as hell atm :/ - Danny
        if ((MMCY - 1 - c) > MMY1) or ((MMCX - 1 - c) > MMX1) or
           ((MMCY + 1 + c) > MMY2) or ((MMCX + 1 + c) > MMX2) then
          Exit;

        // loop through each area (i.e. direction) to get the distance from the player to the fence on the MM
        for i := 0 to high(area) do
          if (dist[i] = 0) then
            // the white color of the fence
            if (findColorTolerance(tpa[i].x, tpa[i].y, 15068652, area[i].x1, area[i].y1, area[i].x2, area[i].y2, 25)) then
            begin
              dist[i] := distance(tpa[i].x, tpa[i].y, MMCX, MMCY);
              inc(distFound);
            end;

        // if all 4 distances are found
        if (distFound = 4) then
        begin
          // calculate the top left and bottom right of the exercise box
          exerciseArea.x1 := tpa[3].x;
          exerciseArea.y1 := tpa[3].y - dist[0];
          exerciseArea.x2 := tpa[1].x;
          exerciseArea.y2 := tpa[1].y + dist[2];

          //SMART_DrawBox(exerciseArea);

          w := (exerciseArea.x2 - exerciseArea.x1);
          h := (exerciseArea.y2 - exerciseArea.y1);
          //writeln('w: '+toStr(w)+', h: '+toStr(h));

          // sometimes the Drill Demon is standing right inline with the player, causing the next white line to be found on the edge of the MM
          result := (inRange(35, w - 7, w + 7) and inRange(20, h - 5, h + 5));
        end;

      until(result or (getSystemTime > t));
    end;

    function DD_ResetPosition: boolean;
    var
      exerciseArea: TBox;
      p: TPoint;
    begin
      if (not loggedIn()) then
        exit;

      if (DD_GetExerciseArea(exerciseArea)) then
      begin
        p := middleBox(exerciseArea);
        mouse(p.x, p.y + 5, 2, 2, mouse_Left);
        Result := True;
      end;
    end;

    function DD_TalkingToDemon: Boolean;
    begin
      Result := (Trim(GetNPCChatName) = 'SergeantDamien');
    end;

    function DD_TalkDemon: Boolean;
    var
      DemonTPA: TPointArray;
      DemonATPA: T2DPointArray;
      x, y, i: Integer;
    begin
      Result := False;

      if (DD_TalkingToDemon) then
      begin
        Result := True;
        Exit;
      end;

      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.15, 1.61);
      FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
      SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
      SortATPASize(DemonATPA, True);

      if (Length(DemonATPA) < 1) then Exit;

      for i := 0 to High(DemonATPA) do
      begin
        if (Length(DemonATPA[i]) < 50) then Continue;
        MiddleTPAEx(DemonATPA[i], x, y);
        MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
        ClickMouse2(mouse_right);
        if (ChooseOptionMulti(['Talk','alk-to'])) then
        begin
          if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
          begin
            DD_Message('[DD_TalkDemon] Talked to demon');
            Result := True;
            Exit;
          end else
            DD_Message('[DD_TalkDemon] Failed to Talked to demon');
        end;
      end;
    end;

    function DD_GetSigns: TBoxArray;
    var
      ESignsTPA: TPointArray;
      ESignsATPA: T2DPointArray;
      SignsSorted: Boolean;
      i: Integer;
    begin
      SetColorToleranceSpeed(1);
      FindColors(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2);
      SplitTPAExWrap(ESignsTPA, 20, 30, ESignsATPA);

      repeat
        SignsSorted := True;
        for i := 0 to High(ESignsATPA) do
        begin
          if (Length(ESignsATPA[i]) < 5) then
          begin
            DeleteValueInATPA(ESignsATPA,i);
            SignsSorted := False;
            Break;
          end;
        end;
      until (SignsSorted);

      SetLength(Result, Length(ESignsATPA));

      for i := 0 to high(ESignsATPA) do
      begin
        Result[i] := GetTPABounds(ESignsATPA[i]);
      end;
    end;

    function DD_FindSign(WhichSign: String): TPoint;
    var
      SB: TBoxArray;
      x, y, i, SBMP: Integer;
      Saccuracy: Extended;
    begin
      Result := Point(-1, -1);

      SB := DD_GetSigns;

      SetColorToleranceSpeed(1);
      SetToleranceSpeed2Modifiers(0.02, 0.02);

      case LowerCase(WhichSign) of
        'jog':       SBMP := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
                            'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlIrVKl' +
                            'rLNxk4tUDAIc3Qs8=');
        'starjumps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
                            '34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdLHOuR' +
                            'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
        'situps':    SBMP := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
                            '473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnqCGtE' +
                            'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I1mHa' +
                            'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
        'pushups':   SBMP := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
                            'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2jaWg' +
                            'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0AjuAl' +
                            '9Q==');
      end;

      for i := 0 to High(SB) do
      begin
        if FindDeformedBitmapToleranceIn(SBMP, x, y, SB[i].X1-5, SB[i].Y1-5,
          SB[i].X2+5, SB[i].Y2+5, 2, 4, False, Saccuracy) then
          begin
            if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Break;
            Result := Point(x + 20, y + 7);
            Break;
          end;
      end;

      FreeBitmap(SBMP);
    end;

    function DD_Solve(): boolean;
    var
      p: TPoint;
      t, tmpCTS, MMoves: Integer;
      tmpHM, tmpSM: Extended;
      MatName: String;
      ClickedMat: Boolean;
    begin
      Result := False;

      if (not LoggedIn) then Exit;

      t := GetSystemTime;

      tmpCTS := GetColorToleranceSpeed;
      GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

      SetAngle(SRL_ANGLE_LOW);
      MakeCompass('N');

      repeat

        Result := TabExists(TAB_MAGIC);

        if (Result) then Exit;

        if (not DD_TalkDemon) then
        begin
          DD_ResetPosition;
          Continue;
        end;

        Wait(RandomRange(1200, 1600));

        case CountColor(0, MCX1, MCY1, MCX2, MCY2) of
          687,988 : MatName := 'jog';
          707     : MatName := 'starjumps';
          569     : MatName := 'situps';
          637,938 : MatName := 'pushups';
          else
          begin
            ClickToContinue;
            Continue;
          end;
        end;

        DD_Message('[DD_Solve] Walking to center');

        if (not DD_ResetPosition) then
        begin
          DD_Message('[ERROR] Failed to walk to center');
          Continue;
        end;

        DD_Message('[DD_Solve] Searching for sign : ' + MatName);

        p := DD_FindSign(MatName);

        if (p.x < 0) or (p.y < 0) then
        begin
          DD_Message('[ERROR] Failed to find sign : ' + MatName);
          Continue;
        end;

        ClickedMat:= False;
        MMoves := 0;

        DD_Message('[DD_Solve] Searching for matt : ' + MatName);

        repeat
          MMouse(p.x, p.y + 64, 40, 20);
          MMoves := MMoves + 1;
          Wait(RandomRange(90, 340));
          if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
          begin
            ClickMouse2(mouse_right);
            if (ChooseOptionMulti(['Use'])) then
            begin
              Wait(RandomRange(1200, 1500));
              if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
              begin
                DD_Message('[DD_Solve] Used Matt');
                ClickedMat := True;
                Break;
              end else
              begin
                DD_Message('[DD_Solve] Failed to Use Matt');
                Continue;
              end;
            end;
          end;
        until (ClickedMat) or (MMoves > 10);

      Result := TabExists(TAB_MAGIC);

      until (Result) or (GetSystemTime - t > 240000);

      if (not Result) then
      begin
        if (GetSystemTime - t > 240000) then
          DD_Message('[ERROR] DrillDemon solver timed out');
      end else
        Wait(RandomRange(1200, 1600));
    end;
    Not sure if this is what you're looking for, but I think it does something useful.
    Based off of the 2 mm photo's, it takes the MM and returns the Middle of the Drill Demon Box.

    Would need to test, in terms of a player that isn't already in the middle of the box.

    Also, just example below, feel free to modify accordingly.


    Simba Code:
    function DD_GetMiddleBox(var TP: TPoint; WhiteCol, Tol: Integer): Boolean;
    var
      x, y: Integer;
      b: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      Result := False;
      FindColorsTolerance(TPA, WhiteCol, MMX1, MMY1, MMX2, MMY2, Tol);
      SplitTPAExWrap(TPA, 5, 5, ATPA); // gets around white player dots
      SortATPAFromSize(ATPA, 100, True); // approx size = 100 of the middle box, at any angle
      b := GetTPABounds(ATPA[0]); // should be sorted to the top, could use fail safes here
      x := (B.X2 + B.X1) / 2;
      y := (B.Y2 + B.Y1) / 2;
      TP := Point(x, y);
      result := (TP.x <> 0) and (TP.y <> 0);
    end;

    Cheers,
    Lj

  6. #131
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    Not sure if this is what you're looking for, but I think it does something useful.
    Based off of the 2 mm photo's, it takes the MM and returns the Middle of the Drill Demon Box.

    Would need to test, in terms of a player that isn't already in the middle of the box.

    Also, just example below, feel free to modify accordingly.


    Simba Code:
    function DD_GetMiddleBox(var TP: TPoint; WhiteCol, Tol: Integer): Boolean;
    var
      x, y: Integer;
      b: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      Result := False;
      FindColorsTolerance(TPA, WhiteCol, MMX1, MMY1, MMX2, MMY2, Tol);
      SplitTPAExWrap(TPA, 5, 5, ATPA); // gets around white player dots
      SortATPAFromSize(ATPA, 100, True); // approx size = 100 of the middle box, at any angle
      b := GetTPABounds(ATPA[0]); // should be sorted to the top, could use fail safes here
      x := (B.X2 + B.X1) / 2;
      y := (B.Y2 + B.Y1) / 2;
      TP := Point(x, y);
      result := (TP.x <> 0) and (TP.y <> 0);
    end;

    Cheers,
    Lj
    Going to try something like this again tomorrow, been trying to do sometime exactly like it all day, just can't get it to work perfect around the entire thing at any compass angle, but I'm really tired so maybe tomorrow I can get it going

    Thanks for the example <3


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  7. #132
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Going to try something like this again tomorrow, been trying to do sometime exactly like it all day, just can't get it to work perfect around the entire thing at any compass angle, but I'm really tired so maybe tomorrow I can get it going

    Thanks for the example <3
    Np, just thought of this; add a loop that searches for the yellow drill demon dot color within the tpa, would probably be very effective in making sure you have the right tpa to find the middle of

    Sorry to everyone, haven't had much time past couple weeks for developing; will have some ample once things die down later next week.

    cheers,
    Lj!! :]

  8. #133
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    Np, just thought of this; add a loop that searches for the yellow drill demon dot color within the tpa, would probably be very effective in making sure you have the right tpa to find the middle of

    Sorry to everyone, haven't had much time past couple weeks for developing; will have some ample once things die down later next week.

    cheers,
    Lj!! :]
    Main issue is, if you rotate the minimap so the top right hand corner of the box is above the other white above it, that sometimes get's caught in the Bounds, maybe with some more tweaking I'll find a good loop method

    Yeh I've been busy too, bank holiday and easter break coming up tho so I should have some more random developing time


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  9. #134
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Good thinking guys. Sorry I am out of town this weekend, but ill take a look when I get back if y'all haven't figured it out by then. Danny are you still in the random?

  10. #135
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Figured I'd try to put into code, what I mean earlier:
    Simba Code:
    program test;
      {$include_once srl/srl.simba}

    function DD_GetCenterPoint(WhiteMMDotCol, YellowMMDotCol, Tol: Integer): TPoint;
    var
      i, w, y: Integer;
      b: TBox;
      TPA, TempTPA: TPointArray;
      ATPA, TempATPA: T2DPointArray;
    begin
      w := WhiteMMDotCol;
      y := YellowMMDotCol;
      FindColorsTolerance(TPA, w, MMX1, MMY1, MMX2, MMY2, Tol);

      // gets around white player dots
      SplitTPAExWrap(TPA, 5, 5, ATPA);
      SetArrayLength(TPA, 0);

      // approx size = 100 of the middle box, at any angle
      SortATPAFromSize(ATPA, 100, True);

      TempTPA := GetMMDotsOnMS('npc');
      if (Length(TempTPA) < 1) then
        Exit;

      for i := 0 to high(ATPA) do
      begin
        TempATPA := FloodFillTPA(ATPA[i]);
        MergeATPAWrap(TempATPA, TPA);
        SetArrayLength(TempATPA, 0);

        if FindTPAInTPA(TempTPA, TPA, TempTPA) then
        begin
          writeln('found the drill demon box on MM');
          Result := MiddleTPA(ATPA[i]);
          break;
        end;
      end;
    end;

    var
      p : TPoint;

    const
      WHITE_HERE = 0;
      YELLOW_HERE = 0;

    begin
      SetupSRL;
      p := DD_GetCenterPoint(WHITE_HERE, YELLOW_HERE, 15);
    end.

    Granted you would need to toy around with the white and yellow MM colors for precision (and they're not filled out in the example).
    Could get the white MM dots, subtract then from a generic all white MM finder and go from there too.
    Like Asha said, don't know if you're in the random still..
    ..but the example above would probably be easier to test whilst inside the random at different angles (because MakeNorth can only do so much with osr not giving more precise angles on the MM given the compass angle) rather than me recreating it with the paint snippets from the postings above.

    Any who, let me know how it goes. :]
    -Lj

  11. #136
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default

    Strange box still needs detection fixing:


  12. #137
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Le Jingle View Post
    Figured I'd try to put into code, what I mean earlier:
    Simba Code:
    program test;
      {$include_once srl/srl.simba}

    function DD_GetCenterPoint(WhiteMMDotCol, YellowMMDotCol, Tol: Integer): TPoint;
    var
      i, w, y: Integer;
      b: TBox;
      TPA, TempTPA: TPointArray;
      ATPA, TempATPA: T2DPointArray;
    begin
      w := WhiteMMDotCol;
      y := YellowMMDotCol;
      FindColorsTolerance(TPA, w, MMX1, MMY1, MMX2, MMY2, Tol);

      // gets around white player dots
      SplitTPAExWrap(TPA, 5, 5, ATPA);
      SetArrayLength(TPA, 0);

      // approx size = 100 of the middle box, at any angle
      SortATPAFromSize(ATPA, 100, True);

      TempTPA := GetMMDotsOnMS('npc');
      if (Length(TempTPA) < 1) then
        Exit;

      for i := 0 to high(ATPA) do
      begin
        TempATPA := FloodFillTPA(ATPA[i]);
        MergeATPAWrap(TempATPA, TPA);
        SetArrayLength(TempATPA, 0);

        if FindTPAInTPA(TempTPA, TPA, TempTPA) then
        begin
          writeln('found the drill demon box on MM');
          Result := MiddleTPA(ATPA[i]);
          break;
        end;
      end;
    end;

    var
      p : TPoint;

    const
      WHITE_HERE = 0;
      YELLOW_HERE = 0;

    begin
      SetupSRL;
      p := DD_GetCenterPoint(WHITE_HERE, YELLOW_HERE, 15);
    end.

    Granted you would need to toy around with the white and yellow MM colors for precision (and they're not filled out in the example).
    Could get the white MM dots, subtract then from a generic all white MM finder and go from there too.
    Like Asha said, don't know if you're in the random still..
    ..but the example above would probably be easier to test whilst inside the random at different angles (because MakeNorth can only do so much with osr not giving more precise angles on the MM given the compass angle) rather than me recreating it with the paint snippets from the postings above.

    Any who, let me know how it goes. :]
    -Lj
    I'll toy around with it today, ofc I'm still in the random not leaving till I get it working lol, I keep nearly letting it solve it by accident tho haha, because if it can see the next sign from the last matt, it just goes ahed


    Quote Originally Posted by slushpuppy View Post
    Strange box still needs detection fixing:
    Strange box was detecting fine for me testerday, opens it and all, just doesn't solve, I think it's handled by Findtalk tho? Maybe invcheck isn't called in FNR?
    Last edited by DannyRS; 03-17-2013 at 02:10 PM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  13. #138
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    @Le Jingle, @Ashaman88, Got it working thanks guys, Deform BMP tolerances may need tweaking to be 100% accurate every time, but I'll have to wait for next demon to test,

    https://github.com/SRL/SRL-OSR/pull/92

    Code:
    ***** Found Random: Drill Demon *****
    [DemonDrill Random] [DD_TalkDemon] Talked to demon
    [DemonDrill Random] [DD_Solve] Walking to center to search for sign
    [DemonDrill Random] [DD_Solve] Searching for sign : jog
    [DemonDrill Random] [DD_Solve] Searching for matt : jog
    [DemonDrill Random] [DD_Solve] Used matt successfully
    [DemonDrill Random] [DD_Solve] Walking to center to search for sign
    [DemonDrill Random] [DD_Solve] Searching for sign : pushups
    [DemonDrill Random] [DD_Solve] Searching for matt : pushups
    [DemonDrill Random] [DD_Solve] Used matt successfully
    [DemonDrill Random] [DD_Solve] Already standing on the matt : pushups
    [DemonDrill Random] [DD_Solve] Using matt : pushups again
    [DemonDrill Random] [DD_Solve] Used matt successfully
    [DemonDrill Random] [DD_Solve] Walking to center to search for sign
    [DemonDrill Random] [DD_Solve] Searching for sign : starjumps
    [DemonDrill Random] [DD_Solve] Searching for matt : starjumps
    [DemonDrill Random] [DD_Solve] Used matt successfully
    [DemonDrill Random] [DD_Solve] Already standing on the matt : starjumps
    [DemonDrill Random] [DD_Solve] Using matt : starjumps again
    [DemonDrill Random] [DD_Solve] Used matt successfully
    ***** Solved Random: Drill Demon *****
    Also got another Pillory Cage, so I tweaked it to be faster and have a better output log

    Simba Code:
    ***** Found Random: Pillory (Cage) *****
    [Pillory Random] [PL_ClickCage] Opened Lock Screen
    [Pillory Random] [PL_GetLock] Lock Found: square [840]
    [Pillory Random] [PL_GetKeys] Keys Found: diamond [493] square [729] circle [506]
    [Pillory Random] [PL_Solve] Clicking key : square
    [Pillory Random] [PL_GetLock] Lock Found: diamond [459]
    [Pillory Random] [PL_GetKeys] Keys Found: circle [506] diamond [603] triangle [286]
    [Pillory Random] [PL_Solve] Clicking key : diamond
    [Pillory Random] [PL_GetLock] Lock Found: triangle [630]
    [Pillory Random] [PL_GetKeys] Keys Found: triangle [286] diamond [493] square [729]
    [Pillory Random] [PL_Solve] Clicking key : triangle
    ***** Solved Random: Pillory (Cage) *****
    Last edited by DannyRS; 03-17-2013 at 06:05 PM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  14. #139
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  15. #140
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Nice job Danny! Ill respond to stuff properly tonight
    No rush however we're badly missing your expertise for the harder randoms <3


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  16. #141
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    I'll toy around with it today, ofc I'm still in the random not leaving till I get it working lol, I keep nearly letting it solve it by accident tho haha, because if it can see the next sign from the last matt, it just goes ahed




    Strange box was detecting fine for me testerday, opens it and all, just doesn't solve, I think it's handled by Findtalk tho? Maybe invcheck isn't called in FNR?
    The strange box is not called by the findtalk. Well it calls for the mysterious old man, but really the solver only initiates the talking one. He has several versions, one takes you to maze, one he just gives you a gift when you talk to him, and one where he gives you the box. Will probably just have to have an inventory check for the boxes in the loop if it isn't added already

    Quote Originally Posted by DannyRS View Post
    Sounds good

    current hp = GetSkillInfo('hitpoints', True);
    max hp = GetSkillInfo('hitpoints', False);

    if current hp < max hp then run;

    should work

    but if your max lvl (99 def) can you always get hit 0 ?
    I believe the randoms combat lvl is always in proportion to your lvl, so they should still be able to hit you. I'll look into adding that feature for the combat randoms

  17. #142
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Yea the randoms are based on your combat level, but I seem to remember being able to easily kill them like nothing at level 128 in decent gear, but I can't remember if they can hit you for dmg or not, they most likely can,

    Calling findtalk and FNR handles the box just fine up to the point of having to solve it


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  18. #143
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Yea the randoms are based on your combat level, but I seem to remember being able to easily kill them like nothing at level 128 in decent gear, but I can't remember if they can hit you for dmg or not, they most likely can,

    Calling findtalk and FNR handles the box just fine up to the point of having to solve it
    Oh ok great about the box. PS couldn't we just do hppercent <> 100 for the combat ones?

  19. #144
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Oh ok great about the box. PS couldn't we just do hppercent <> 100 for the combat ones?
    I've never used that operator because I'm noob , <> is "not equal to" right? is there an include that returns hp percent? Are we talking on the overhead hp bar or in the stats panel?


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  20. #145
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    I've never used that operator because I'm noob , <> is "not equal to" right? is there an include that returns hp percent? Are we talking on the overhead hp bar or in the stats panel?

    Simba Code:
    (*
    HPPercent
    ~~~~~~~~~

    .. code-block:: pascal

        function HpPercent: Integer;

    Returns Hp left as a percentage from skill panel
    returns -1 is unsuccessful.

    .. note::

        by DannyRS
        Last Modified: Feb. 28th, 2013 by DannyRS

    Example:

    .. code-block:: pascal
    *)

    function HPPercent(SwapGTabBack: Boolean): Integer;
    var
      OrigTab,CHP,CMHP: Integer;
    begin
      Result := -1;
      if (SwapGTabBack) then OrigTab := GetCurrentTab;
      if (GameTab(tab_Stats)) then
      begin
        CHP := GetSkillInfo('hp',True);
        CMHP := GetSkillInfo('hp',False);
        Result := Round((CHP*100/CMHP));
        if (SwapGTabBack) then GameTab(OrigTab);
      end;
    end;


    <> just means not equal yeah. You wrote that silly :P. Wouldn't that work though? if hppercent(true)<>100 then runnnn?

  21. #146
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    <> just means not equal yeah. You wrote that silly :P. Wouldn't that work though? if hppercent(true)<>100 then runnnn?
    Ah, hahaha, gametab is like 2000 lines long, I forget what's in it rofl, I just zombie re-wrote the SRL5 functions to work in 07 as in, read description what it's meant to do, make it work,

    It should work I guess? Can't see why not, Give it a shot, also note that for hp bar detection, MSCX and MSCY are nowhere near the center of your in-game character - Idk if you noticed this yet, and I didn't look if you even used em

    Also noticed FindTalk; for evil chicken was overriding FNR; and not running, may just be the way I have it set up in my script, also chicken has no uptext (because its a combat mob higher level than you), maybe a rightclick regardless of uptext is needed?
    Last edited by DannyRS; 03-18-2013 at 02:51 AM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  22. #147
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Ah, hahaha, gametab is like 2000 lines long, I forget what's in it rofl, I just zombie re-wrote the SRL5 functions to work in 07 as in, read description what it's meant to do, make it work,

    It should work I guess? Can't see why not, Give it a shot, also note that for hp bar detection, MSCX and MSCY are nowhere near the center of your in-game character - Idk if you noticed this yet, and I didn't look if you even used em

    Also noticed FindTalk; for evil chicken was overriding FNR; and not running, may just be the way I have it set up in my script, also chicken has no uptext (because its a combat mob higher level than you), maybe a rightclick regardless of uptext is needed?
    Yeah it doesn't use mscx or cy for the detection. As for the chicken, does it only attack you? I think the combat randoms are called before the findtalk ones in findnormalrandoms, am I right? So it might hover over it when it sees your name but after a few hits it should detect the combat and run right?

  23. #148
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Yeah it doesn't use mscx or cy for the detection. As for the chicken, does it only attack you? I think the combat randoms are called before the findtalk ones in findnormalrandoms, am I right? So it might hover over it when it sees your name but after a few hits it should detect the combat and run right?
    I had to stop it because it was destroying me and I was going to die haha, it appeared to hover the chicken, do nothing for a sec (obviously as no uptext) then I resumed thieving (my procedures) then it tried to hover the chicken again when it said "Bawk Bawk" or whatever (my rsn contains none of those characters) then back to thieving, by this time my hp bar had been up for quite a bit, I'll do more testing today and try and troubleshoot if it's my script or the setup in FNR;


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  24. #149
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    I had to stop it because it was destroying me and I was going to die haha, it appeared to hover the chicken, do nothing for a sec (obviously as no uptext) then I resumed thieving (my procedures) then it tried to hover the chicken again when it said "Bawk Bawk" or whatever (my rsn contains none of those characters) then back to thieving, by this time my hp bar had been up for quite a bit, I'll do more testing today and try and troubleshoot if it's my script or the setup in FNR;
    That is strange that it hovered then...you sure it wasn't confused thinking it was thieving? Also was the angle high or low? I'm not 100% if it works on low, I didn't test it there oops

  25. #150
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    That is strange that it hovered then...you sure it wasn't confused thinking it was thieving? Also was the angle high or low? I'm not 100% if it works on low, I didn't test it there oops
    Was on high, Compass North, 100% sure it wasn't thieving as my loop simply hovers stall till uptext, and mouse moved away from chicken, thieving again now, we'll see


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

Page 6 of 10 FirstFirst ... 45678 ... LastLast

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
  •