Page 1 of 2 12 LastLast
Results 1 to 25 of 31

Thread: Question about FindDeformedBitmapToleranceIn

  1. #1
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Question about FindDeformedBitmapToleranceIn

    SCAR Code:
    function FindDeformedBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;

    the variable accuracy, what do i need to typ there? I don't understand it how the manual explains it ..

    Thanks for your time

    EDIT: I released my script here!!
    Srl simply rocks.

  2. #2
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Accuracy only returns something (the accuracy where the Bitmap is found with).
    You could use it for something like:

    if accuracy >= 0.9 then WriteLn('Accuracy was higher then 0.9);
    Hup Holland Hup!

  3. #3
    Join Date
    Apr 2007
    Posts
    186
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I wonder how you know all these nielsie, you read them somewhere or is it just knownledge ?

  4. #4
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well he's been here +50%, you can learn lots of SRL and pascal in that time if u have the motivation to learn it(like me , read pascal 2 weeks now and I'm already doing 2 scripts. Going to start to do powerminer after I do my PwNZoRChoPPeR! )

  5. #5
    Join Date
    Apr 2007
    Posts
    186
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    power miner is pretty basic

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    I use this on large static objects. I usually take a slice of the BitMap. (8*1 or 1*8)

    SCAR Code:
    {*******************************************************************************
    function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: String; BMP, a, b, c, d: Integer): Boolean;
    By: WT-Fakawi
    Description: Finds Object in Box a,b,c,d, specified by BitMap and Uptext1 or Uptext2
    Returns coords in ObjX and ObjY.
    Uses Deformed Bitmap. FindObjectDeformed will gradually lower Tol and reduce Accuracy.
    Functon can cause severe Lag when using bitmaps bigger then 16 pixels. Works but Lags.
    *******************************************************************************}


    function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: string;
      BMP, a, b, c, d: Integer): Boolean;
    var
      acc, ref: Extended;
      XT, YT, times, tol: Integer;
    begin
      ref := 0.9;
      tol := 0;
      for times := 1 to 50 do
      begin
        FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
        if (acc >= ref) then
        begin
          MMouse(XT, YT, 0, 0);
          Wait(400 + Random(400));
          if (IsUpText(UpText1) or IsUpText(UpText2)) then
          begin
            ObjX := XT;
            ObjY := YT;
            Result := True;
            Exit;
          end;
        end;
        if times mod 5 = 0 then
        begin
          ref := ref - 0.1;
          tol := tol + 10;
        end;
        Wait(1);
      end;
    end;
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  7. #7
    Join Date
    Apr 2007
    Posts
    186
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is that good for finding tree ? and does it lag if the bmp is 4*4 pixels ?

  8. #8
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    A one-dimensional "sliced" Bitmap (x*1 or 1*x) seems to reduce the level of processing.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  9. #9
    Join Date
    Mar 2006
    Location
    United States, -7:00 GMT
    Posts
    1,790
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Don't u use that in some gate finder fawk..? ANd its a beauty..? :P

    hakuna matata ;)

  10. #10
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Ejjman1 View Post
    Don't u use that in some gate finder fawk..? ANd its a beauty..? :P
    No, just for static mainscreen objects. Its not bad for agility courses f.i.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  11. #11
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    @inSane: If you want to use it for TreeFinding, I suggest you look into Charmz Willow Chopper. He has an (unused) procedure which uses Deformed Bitmaps to find a tree.. He didn't use it, because it was too slow. But it's still in there I think
    Hup Holland Hup!

  12. #12
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @ Nielsie -> I get this error
    [Error] (21194:86): Unknown identifier 'accuracy' in script
    Srl simply rocks.

  13. #13
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Set it as an extended variable. Also take a look at the function Fawki posted
    Hup Holland Hup!

  14. #14
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1) Shouldn't the variable allready be set in SCAr itself?..

    2) I only can use bmps of 1.x or x+.1 with WT-Fawaki's procedure?

    EDIT: I need to find a bitmap on the minimap, so the IsUpText isn't needed ..

    EDIT2: I think I am going to use FindDeformed
    Srl simply rocks.

  15. #15
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm..

    Line 18: [Error] (18150:10): Duplicate identifier 'FINDBITMAPSPROGRESSIVETOL' in script C:\Program Files\SCAR 2.03\includes\SRL/SRL/Core/BitMap.scar


    EDIT: Oke, finddeformed doesn't work .. =/
    Srl simply rocks.

  16. #16
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Try this:

    SCAR Code:
    function FindDeformedMM(var tx, ty: Integer; BMP: integer): Boolean;
    var
      acc, ref: Extended;
      XT, YT, times, tol: Integer;
    begin
      ref := 0.9;
      tol := 0;
      for times := 1 to 50 do
      begin
        FindDeformedBitmapToleranceIn(BMP, XT, YT, MMX1, MMY1, MMX2, MMY2, tol, 2, True, acc);
        if (acc >= ref) then
        begin
          tx := XT;
          ty := YT;
          Result := True;
          Exit;
        end;
        if times mod 5 = 0 then
        begin
          ref := ref - 0.05;
          tol := tol + 5;
        end;
        Wait(20);
      end;
    end;
    Hup Holland Hup!

  17. #17
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You made it?
    Srl simply rocks.

  18. #18
    Join Date
    Apr 2007
    Posts
    186
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    @inSane: If you want to use it for TreeFinding, I suggest you look into Charmz Willow Chopper. He has an (unused) procedure which uses Deformed Bitmaps to find a tree.. He didn't use it, because it was too slow. But it's still in there I think
    Ok, thanks!

  19. #19
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great .. I use
    if (FindDeformedMM) then
    and i get a unrealistic error "Invalid numbers of parameters" ...

    EDIT: I changed it into
    if (FindDeformedMM(XT, YT, MMRock)) then
    I hope thats correct?
    Srl simply rocks.

  20. #20
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Yes, made by me and did it work?
    Hup Holland Hup!

  21. #21
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Not really =/

    function FindDeformedMM(var TX, TY: Integer; BMP: integer): Boolean; //By Nielsie95
    begin
    Ref := 0.9;
    Tol := 20;
    for Times := 1 to 50 do
    begin
    FindDeformedBitmapToleranceIn(MMRock, XT, YT, MMX1, MMY1, MMX2, MMY2, Tol, 10, True, Acc);
    if (Acc >= Ref) then
    begin
    TX := XT;
    TY := YT;
    Result := True;
    Exit;
    end;
    if Times mod 5 = 0 then
    begin
    Ref := Ref - 0.05;
    Tol := Tol + 5;
    end;
    Wait(20 + Random(20));
    end;
    end;
    Error:

    [Runtime Error] : Exception: Access violation at address 00650D9B in module 'scar.exe'. Read of address 00000034 in line 1194 in script ...
    Srl simply rocks.

  22. #22
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    This should work:

    SCAR Code:
    function FindDeformedMM(var TX, TY: Integer; BMP: integer): Boolean; //By Nielsie95
    var ref, acc: extended; Tol, Times, XT, YT: integer;
    begin
      Ref := 0.9;
      Tol := 20;
      for Times := 1 to 50 do
      begin
        FindDeformedBitmapToleranceIn(BMP, XT, YT, MMX1, MMY1, MMX2, MMY2, Tol, 10, True, Acc);
        if (Acc >= Ref) then
        begin
          TX := XT;
          TY := YT;
          Result := True;
          Exit;
        end;
        if Times mod 5 = 0 then
        begin
          Ref := Ref - 0.05;
          Tol := Tol + 5;
        end;
        Wait(20 + Random(20));
      end;
    end;

    Can you show the bmp and which version of SRL and SCAR do you use?
    Hup Holland Hup!

  23. #23
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Erm .. Did you changed something? [My vars are at the begin of my script]

    Also, i used this on my script:

    SCAR Code:
    begin
          if (FindDeformedMM(XT, YT, MMRock)) then
          begin
            Mouse(XT, YT, 2, 2, True);
            Wait(3000 + Random(2000));
          end else
          begin
            Writeln('Could not find the MMRock.. Nextplayer');
            RandomNextPlayer(False);
            Exit;
          end;
        end;

    Did i used the
    if (FindDeformedMM(XT, YT, MMRock)) then
    correct?
    Srl simply rocks.

  24. #24
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Try keeping those vars in the function (it's easier to read ).
    And yes, I changed something..
    If you want to do it without vars, it's this:

    SCAR Code:
    function FindDeformedMM(var TX, TY: Integer; BMP: integer): Boolean; //By Nielsie95
    begin
      Ref := 0.9;
      Tol := 20;
      for Times := 1 to 50 do
      begin
        FindDeformedBitmapToleranceIn(BMP, XT, YT, MMX1, MMY1, MMX2, MMY2, Tol, 10, True, Acc);
        if (Acc >= Ref) then
        begin
          TX := XT;
          TY := YT;
          Result := True;
          Exit;
        end;
        if Times mod 5 = 0 then
        begin
          Ref := Ref - 0.05;
          Tol := Tol + 5;
        end;
        Wait(20 + Random(20));
      end;
    end;

    And yes, you used it right, but I would suggest not using XT and YT again. Try it with x and y?

    If you want it, to not screw up, do this:

    SCAR Code:
    try
        begin
          if (FindDeformedMM(XT, YT, MMRock)) then
          begin
            Mouse(XT, YT, 2, 2, True);
            Wait(3000 + Random(2000));
          end
        end
      except    
          begin
            Writeln('Could not find the MMRock.. Nextplayer');
            RandomNextPlayer(False);
            Exit;
          end;
       end;
    Hup Holland Hup!

  25. #25
    Join Date
    Jan 2007
    Posts
    513
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @ function What did you changed then?

    @ try , except what does that does?
    also, it would be
    SCAR Code:
    try
        begin
          if (FindDeformedMM(XT, YT, MMRock)) then
          begin
            Mouse(XT, YT, 2, 2, True);
            Wait(3000 + Random(2000));
          end
        end
      except    
          begin
            Writeln('Could not find the MMRock.. Nextplayer');
            RandomNextPlayer(False);
            Exit;
          end;
       end;
    if i want to use the x, y and not the XT , YT?

    I am a bit confused ..
    Srl simply rocks.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindDeformedBitmapToleranceIn
    By Olaf Forkbeard in forum OSR Help
    Replies: 9
    Last Post: 03-02-2009, 03:45 AM
  2. Replies: 6
    Last Post: 07-08-2007, 04:13 PM
  3. Question
    By Euro-Stylz in forum News and General
    Replies: 6
    Last Post: 03-06-2007, 06:12 AM
  4. FindDeformedBitmapToleranceIn
    By raimis89 in forum OSR Help
    Replies: 9
    Last Post: 01-12-2007, 03:04 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
  •