Results 1 to 13 of 13

Thread: A list of fixes

  1. #1
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default A list of fixes

    Firemaking.scar:

    WeHaveLogs is outdated. here is the fix:
    SCAR Code:
    Function FindLogs(Var X, Y : Integer): Boolean;
    Var
      Logs : Integer;
    Begin
      Logs := DTMFromString('78DA63DCC8C4C0F08A010D30229140FA2450C' +
           'D4D026AB601D5DC25A0E61450CD23026ACE01D5BC26A0663750CD' +
           '47FC6A00BF630A00');
      GameTab(4);
      Wait(250 + Random(250));
      Result := FindDTM(Logs, X, Y, MIX1, MIY1, MIX2, MIY2);
      FreeDTM(Logs);
    End;
    Also it should have a findtinderbox:
    SCAR Code:
    Function FindTinderbox(Var X, Y : Integer): Boolean;
    Var
      TinderBox : Integer;
    Begin
      TinderBox := DTMFromString('78DA638C67626078C18006189148205D0A547' +
           '39D809A04A09A7B04D49400D5DC27A0A61CA8E60D0135E940351F' +
           'F1AB0100C4B607FE');
      GameTab(4);
      Wait(250 + Random(250));
      Result := FindDTM(TinderBox, X, Y, MIX1, MIY1, MIX2, MIY2);
      FreeDTM(TinderBox);
    End;

    Cooking.scar:
    FindRange still works but it laggs a lot and sometimes it doesn't work. It uses DTM to find the range in the mainscreen, which makes it very slow. Here is the TPA version:
    SCAR Code:
    Function FindRange(Var X, Y : Integer): Boolean;
    Var
      TPA : TPointArray;
      ATPA : T2DPointArray;
      I, H : Integer;
    Begin
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 1385376, MSX1, MSY1, MSX2, MSY2, 15);
      If Length(TPA) = 0 Then
        Exit;
      ATPA := TPAtoATPAEx(TPA, 50, 50);
      H := High(ATPA);
      For I := 0 To H Do
      Begin
        If Length(ATPA[I]) > 50 Then
        Begin
          Result := True;
          MiddleTPAex(ATPA[I], X, Y);
          Exit;
        End;
      End;
    End;

    Fighting.scar:
    IsFightAt searches in a 20*20 square for the bar so if it is a big moster(lesser demon for example) it won't find it. Fix:
    SCAR Code:
    Function IsFightAt(CX, CY : Integer): Boolean;
    Var
      ATPA : T2DPointArray;
      X, Y : Integer;
    Begin
      ATPA := FindAllHPBars(CX,CY, MSCY, MSX1, MSY1, MSX2, MSY2);
      If (Length(ATPA) = 0) Then
        Exit;
      MiddleTPAEx(ATPA[0], X, Y);
      Result := (Distance(X, Y, CX, CY) <= 45);
    End;

    Damage will always call getskillinfo making it to change the tab every time. It can be replaced with GetMMLevels:
    SCAR Code:
    Function Damage: Integer;
    Var
      S : String;
    Begin
      If Players[CurrentPlayer].Level[8] = 0 Then
        Players[CurrentPlayer].Level[8] := GetSkillInfo('hp', False);
      S := GetMMLevels('hp', S) - Players[CurrentPlayer].Level[8];
    End;


  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Nice Cazax!

    You seem to be on top of your game lately, Keep it up.

    rep+

  3. #3
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    This works fine for me:
    SCAR Code:
    function FindFire(var x, y: integer): Boolean;
    var
      P: TPointArray;
      Fire, Tol, j, fx, fy: integer;
      B: TBox;
      a: extended;
    begin
      if not LoggedIn then Exit;
      Debug('FindFire');
      FindColorsSpiralTolerance(MSCX, MSCY, P, 3385314, MSX1, MSY1, MSX2, MSY2, 40);
      RemovePointsInBox(P, PointToBox(Point(31, 4), Point(129, 24)));
      if Length(P) < 10 then Exit;
      Fire := BitmapFromString(1, 11, '3B3000F4C63FF8C83FF4C73EE6' +
        'BC39E6BC39BC922CE6BE45BC9E38BC9E3B352A00');
      Tol := 40;
      B := GetTPABounds(P);
      try
        for j := 1 to 3 do
        begin
          FindDeformedBitmapToleranceIn(Fire, fx, fy, B.x1-10, B.y1-10, B.x2+10, B.y2+10, Tol, 2, True, a);
          if a >= 1-j*0.2 then
          begin
            x := fx;
            y := fy+4;
            Result := True;
            Exit;
          end;
          DecEx(Tol, 5);
        end;
      except
        writeln('Exception');
      finally
        FreeBitmap(Fire);
      end;
    end;
    ;

  4. #4
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by lordsaturn View Post
    This works fine for me:
    SCAR Code:
    function FindFire(var x, y: integer): Boolean;
    var
      P: TPointArray;
      Fire, Tol, j, fx, fy: integer;
      B: TBox;
      a: extended;
    begin
      if not LoggedIn then Exit;
      Debug('FindFire');
      FindColorsSpiralTolerance(MSCX, MSCY, P, 3385314, MSX1, MSY1, MSX2, MSY2, 40);
      RemovePointsInBox(P, PointToBox(Point(31, 4), Point(129, 24)));
      if Length(P) < 10 then Exit;
      Fire := BitmapFromString(1, 11, '3B3000F4C63FF8C83FF4C73EE6' +
        'BC39E6BC39BC922CE6BE45BC9E38BC9E3B352A00');
      Tol := 40;
      B := GetTPABounds(P);
      try
        for j := 1 to 3 do
        begin
          FindDeformedBitmapToleranceIn(Fire, fx, fy, B.x1-10, B.y1-10, B.x2+10, B.y2+10, Tol, 2, True, a);
          if a >= 1-j*0.2 then
          begin
            x := fx;
            y := fy+4;
            Result := True;
            Exit;
          end;
          DecEx(Tol, 5);
        end;
      except
        writeln('Exception');
      finally
        FreeBitmap(Fire);
      end;
    end;
    ;
    FindBitmapDeformed is really really slow AFAIK. TPA is much quicker
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Problem with IsFightAt is that it'll look horizontally to far imo. Have to have it look in a vertical way only which with a FindColor you can do ezily.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Your FindFire function doesn't find the fire very well, sorry to say.

  7. #7
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was testing with willows in draynor... Maybe the fire changes? I will test.
    @Narcle: Are you talking about Distance? because it searches in a circle around the point, not any specific direction.


  8. #8
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Well the hp functions of mine worked excellent at goblins, all I know

    SCAR Code:
    C Y

    Happy colon expected error!

    Naughty boy making fixes without even checking if they compile, eh?

  9. #9
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, updated the findfire(hopefully). To test it:
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    Function DebugATPA(aPoints: Array Of TPointArray; BmpName: String): Boolean; //Wizzup

    Var
       Width, Height, ClientBMP, I, L, C, Col: Integer;
       xs, ys, xe, ye: Integer;
       OuterPoints: TPointArray;

    Begin
      For I := 0 To High(aPoints) Do
        L := L + Length(aPoints[i]);
      SetLength(OuterPoints, L + 1);
      C := 0;
      For I := 0 To High(aPoints) Do
        For L := 0 To High(aPoints[i]) Do
        Begin
          C := C + 1;
          OuterPoints[C] := aPoints[i][L];
        End;

      Try
      Begin
        xe := xs xor xs;
        ye := ys xor ys;
        xs := 1 shl 20;
        ys := 1 shl 20;

        For I := 0 To High(OuterPoints) Do
        Begin
          xs := Min(xs, OuterPoints[i].X);
          ys := Min(ys, OuterPoints[i].Y);

          xe := Max(xe, OuterPoints[i].X);
          ye := Max(ye, OuterPoints[i].Y);
        End;

        Width := xe - xs;
        Height := ye - ys;

        DisplayDebugImgWindow(0, 0);
        DisplayDebugImgWindow(Width, Height);
        ClientBMP := BitmapFromString(Width, Height, '');

        CopyClientToBitmap(ClientBMP, xs, ys, xe, ye)
        For I := 0 To High(aPoints) Do
        Begin
          Col := Random(16777215);
          For L := 0 To High(aPoints[i]) Do
            FastSetPixel(ClientBMP, aPoints[i][L].X - xs, aPoints[i][L].Y - ys, Col);
        End;

        SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
        DisplayDebugImgWindow(Width, Height);
        If BmpName <> '' Then
          SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');

        FreeBitmap(ClientBMP);
      End
      Except
        FreeBitmap(ClientBMP);
      End;
      Result := True;
    End;

    Function FindFire(Var X, Y : Integer): Boolean;
    Var
      TPA, FP : TPointArray;
      ATPA : T2DPointArray;
      I, Hi : Integer;
      H, S, L : Extended;
    Begin
      ColorToleranceSpeed(3);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5158121, MSX1, MSY1, MSX2, MSY2, 50);
      ColorToleranceSpeed(1);
      If Length(TPA) = 0 Then
        Exit;
      Hi := High(TPA);
      For I := 0 To Hi Do
      Begin
        ColorToHSL(GetColor(TPA[i].X, TPA[i].Y), H, S, L);
        If (H > 8.0) And (H < 12.0) Then
        Begin
          SetLength(FP, Length(FP) + 1);
          FP[High(FP)] := TPA[i];
        End;
      End;
      If Length(FP) = 0 Then
        Exit;
      ATPA := TPAtoATPA(FP, 25);
      DebugATPA(ATPA, '');
      Hi := High(ATPA);
      For I := 0 To Hi Do
      Begin
        If Length(ATPA[i]) >= 250 Then
        Begin
          MiddleTPAex(ATPA[i], X, Y);
          Result := True;
          Exit;
        End;
      End;
    End;
    var
      x, y : integer;
    begin
      ActivateClient;
      SetupSRL;
      Wait(500);
      FindFire(X, y);
      Mouse(x, y, 2, 2, true);
    end.

    @n3s: Happy now ?


  10. #10
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    If anybody can test an confirm these work at least near perfectly I'll be more than happy to add them.

  11. #11
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    With the length check included..
    SCAR Code:
    For I := 0 To Hi Do
      Begin
        If Length(ATPA[i]) < 250 Then
          atpa[i] := [];
      End;
      debugatpa(atpa,'');

  12. #12
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by lordsaturn View Post
    With the length check included..
    SCAR Code:
    For I := 0 To Hi Do
      Begin
        If Length(ATPA[i]) < 250 Then
          atpa[i] := [];
      End;
      debugatpa(atpa,'');
    Then SRL should keep the bitmap finding... I'm removing it.


  13. #13
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Also DoEmote isn't compatable, Fixed it .

    SCAR Code:
    procedure DoEmote(Number: Integer);
    var
      row, X1, Y1, X2, Y2, Others, EmoteNumber: Integer;
    begin
      EmoteNumber := Number;
      if (not(InRange(EmoteNumber, 1, 45))) then
      begin
        srl_Warn('DoEmote', 'Invalid EmoteNumber: ' + IntToStr(EmoteNumber) + ', Valid Emotes: 1..45', warn_AllVersions);
        Exit;
      end;
      GameTab(12);
     
      if (InRange(EmoteNumber, 21, 39)) then
      begin
        if (GetColor(734, 442) = 3029569) then
          Mouse(731, 362, 5, 5, True);
        EmoteNumber := EmoteNumber - 20;
        Others := 10;
      end else if (GetColor(733, 224) = 3029569) then
        Mouse(727, 224, 5, 5, True);
     
      if (EmoteNumber > 40) then
        Begin
          Mouse(728, 444, 5, 5, True);
          EmoteNumber := EmoteNumber - 28;
        end;
     
      if (EmoteNumber > 4) then
      begin
        repeat;
          row := row + 1;
          EmoteNumber := EmoteNumber - 4;
        until (EmoteNumber <= 4) or (row = 12)
      end;
     
      if (row >= 5) then
        row := row - 5;
      EmoteNumber := EmoteNumber - 1;
      X1 := 554 + (43 * EmoteNumber);
      Y1 := 211 + (49 * row) + Others;
      X2 := 592 + (43 * EmoteNumber);
      Y2 := 257 + (49 * row) + Others;
      MouseBox(X1 + 10, Y1 + 10, X2 - 10, Y2 - 10, 1);
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SMART Fixes.
    By Nava2 in forum Research & Development Lounge
    Replies: 339
    Last Post: 12-20-2008, 06:19 AM
  2. SMART Fixes?
    By buggyboy33 in forum OSR Help
    Replies: 0
    Last Post: 10-26-2008, 02:09 AM
  3. Replies: 23
    Last Post: 01-08-2008, 01:20 AM

Posting Permissions

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