Results 1 to 10 of 10

Thread: FindBitmap not working

  1. #1
    Join Date
    Mar 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindBitmap not working

    For some reason my findbitmap isn't working. It keeps returning the bottom-left corner of my selected app.

    This is my first attempt at a scar script, I come from ActionScript so I know the basics of programming (variables etc..)

    Here's the script:
    Code:
    program AutoDropper;
    
    const
       drop_first = false;
       // false if pick/hatchet is in first invy slot.
    
    
    procedure mouse(x,y:integer; leftMouse:boolean);
    begin
       moveMouseSmooth(x,y);
       wait(50+random(100));
       holdMouse(x,y,leftMouse);
       wait(50+random(100));
       releaseMouse(x,y,leftMouse);
    end;
    
    procedure clickInvy(col,row:integer; leftMouse,clickIfItem:boolean; var itemFound:boolean);
    var
       x,y,x2,y2: integer;
       itemPresent: boolean;
    begin
       x:= 573+(42*(col-1))+random(10);
       y:= 222+(36*(row-1))+random(10);
    
       moveMouseSmooth(x,y);
       wait(100+random(100));
       
       if(clickIfItem)then
       begin
          itemPresent:= findColorTolerance(x2,y2,14804451,0,0,15,15,35);
          itemFound:= itemPresent;
       end;
       
       if((clickIfItem and itemPresent) or not(clickIfItem))then
       begin
          holdMouse(x,y,leftMouse);
          wait(50+random(100));
          releaseMouse(x,y,leftMouse);
       end;
    end;
    
    procedure clearPopUp();
    var
       x,y: integer;
    begin
       getMousePos(x,y);
       moveMouseSmooth(x-(100+random(50)),y-(100+random(50)));
    end;
    
    var
       dropImg,col,row,x,y: integer;
       itemFound: boolean;
    
    begin
       dropImg := BitmapFromString(2, 10, 'beNrbMfXYDnIRAPCmKX0=');
       itemFound:= false;
       row:= 0;
       col:= 1;
       if(drop_first)then
       begin
          col:= 0;
       end;
       
       repeat
          inc(row);
          repeat
             inc(col);
             clickInvy(col,row,false,true,itemFound);
             if(itemFound)then
             begin
                if(findBitmap(x,y,dropImg))then
                begin
                   moveMouseSmooth(x,y);
                   wait(1000+random(50));
                   clickMouse(x,y,true);
                end else begin
                   clearPopUp();
                end;
                wait(100+random(50));
             end;
          until(col > 3);
          col:= 0;
       until(row > 6);
    
       freeBitmap(dropImg);
    end.
    Any comments on how to improve my script (other than the problem above) would be awesome

    thanks,
    Shoyukenn.

  2. #2
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    If you are using a bitmap to find an item on RuneScape, you should use FindBitmapToleranceIn (It allows to you add tolerance, and set parameters on where you want SCAR to search for the bitmap.

    If you need help with it, click the bitmap tutorial link that is in my sig.
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  3. #3
    Join Date
    Mar 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't need to use a tolerance though, the bitmap is being found (findBitmap is returning true).

    The problem is that it's returning incorrect x and y coordinates.

  4. #4
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    What version of scar are you using? And what OS do you use?
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  5. #5
    Join Date
    Mar 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Divi 3.22 w/ XP 32 bit

  6. #6
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Try 3.23 instead.

  7. #7
    Join Date
    Mar 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    from freddy1990.com:



    Unless he released a new version and didn't update the website?

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

    Default

    Quote Originally Posted by Shoyukenn View Post
    from freddy1990.com:



    Unless he released a new version and didn't update the website?
    It's a Beta release.

    You have to download via SVN.

    http://villavu.com/forum/showthread.php?t=47714

  9. #9
    Join Date
    Mar 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah, it is my scar. I made a quick test script (should have done it when the problem first occurred, I know) to search for something that I know is there (the firefox icon).

    I'll download the new version and tell you how it goes.

    Apart from the error, any comments on my first script?

  10. #10
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Shoyukenn View Post
    Ah, it is my scar. I made a quick test script (should have done it when the problem first occurred, I know) to search for something that I know is there (the firefox icon).

    I'll download the new version and tell you how it goes.

    Apart from the error, any comments on my first script?
    I have no idea what it's for, but for a fist script I don't think it's too bad. Your standards are pretty good. You should add spaces after characters like ',' '+' '-' etc. and after bold words like if (condition) then.

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
  •