Results 1 to 6 of 6

Thread: Why does my script think its found a Bitmap?

  1. #1
    Join Date
    Apr 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default Why does my script think its found a Bitmap?

    Hey,I'm having a bit of trouble with the Find-bitmap Procedure. It doesn't seem to matter what color, shape, or where I place the image, my script is convinced it can see the image.
    Although It returns (0,0) X,Y co-ordinates. Any Idea what I'm doing wrong? Thanks.


    Code:
    program Bitmap_Test
    var
      x,  y , Icon:  Integer;  
      
      Begin
    
    Icon := BitmapFromString(55, 65, 'meJztmH9QVOUax/lnF+JSeUmaa+' + 'ptLJpJsiZvQzaL/hHpTbMaRzFFnX6ArpplM4peQ0hTvFmabYTeBFF' + 'DwCnEUtYtEVFBKmGpFLyKCxkSXH81U6T9uE3D/bw863uPi2yzB7Ox' + '9p1njoez73nP53y/7/O877G9/SpoX18NrSPYgi3Y/qgtPCGVCB0zT' + '8I6OsU68mljWOKmWmIn/oaEMMw8+j2RfKhtyqHTHBPdrWM+bh6+r3' + 'nYzobBW9wD1pT0XrguPOnl34oTwvTWjvSmcxov4UDT6IrGv+9tiC+' + 'ti9taOzC/ql+Ws3dGfvgzq1H4ynPirA8hAo7d7xm1xwPhvc56ZNSQ' + 'EXOywhMXLZ43e+WShY5lL7yx/EWf4CI/ZTw/h6Db/GemXQbCsWng4' + 'bIPoWg49IP6rpDXPrUIgJ9//slP/HjubPvZ1np3VX7OG7OSp/SIcN' + 'Ki655dSUT+I6vvsryYfxXfmVca76zB6NTDLYfPn3/lizOTq5tAHbz' + '545jcHfQRSCQ6e7IFEv+czcfqNq5etdtZPO2JCaQkece8ChhyzLxB' + 'bV/ffvxMvyOtUZ+e6HWg6drKBm1xaOGH1nW7I15yRqS/Y3ku25KwR' + 'CV47ETLoHGY2J3dxuBFgOQonJHzc3iiJXpkoJBoRaxubNWRfaKN40' + 'sNbS/XeZbVNsw7cGTGR/9OcFXft8HVP32tEmTQOB7UWO/2oyRgRW9' + 'lMys48ieS7ijKT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8XRmk8' + '089mquzs88U0h2MLxiQkjKssDGKLcTW9Zau44Co38hnNGNn6SZac5' + 'Hx7YyvegUG6XOjKHRZIPXICGizOa4wpH+79Tk9HDamh0cbdLns9nl' + 'TL7mhTrp48IUHdf6rMCRBdOLIyDpH7Nxhu+hxxvmv7/UD2WFIHJk5' + 'XV8q2IIt2IIt2H4H7X+xzCK2'); 
    
      if FindBitmapIn(Icon, x, y, 25, 0, 500, 1071)  then
          writeln('Found it!');
          Writeln('X ', x, '  Y ', y);
          MoveMouse(x, y);
          ClickMOuse(x, y, 1);
          Wait(3000);
          FreeBitmap(Icon);
    end.
    Here's the image I am using Extract.jpg (Wasn't allowed to post a .bpm image, I am using a .bmp in Simba)
    Last edited by Fidget; 12-17-2017 at 04:03 PM.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,318
    Mentioned
    264 Post(s)
    Quoted
    1394 Post(s)

    Default

    Could you provide the bitmap or at least an image containing it so I can try it for myself?

    Current project:
    [Scripts / AeroLib Rev. 2]


    Did you know?
    J1407b, dubbed "Saturn on steriods", has a ring system 200 times larger than Saturn's own rings.
    #teampixel

  3. #3
    Join Date
    Apr 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Could you provide the bitmap or at least an image containing it so I can try it for myself?
    Of Course! https://villavu.com/forum/attachment...0&d=1513526489 Villavu doesn't seem to like me uploading .Bmp's. Not sure if this is any good? Capture.PNG You could always open in Paint and save as Bmp.
    Last edited by Fidget; 12-17-2017 at 04:51 PM.

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,318
    Mentioned
    264 Post(s)
    Quoted
    1394 Post(s)

    Default

    Give this script a shot mate:

    Simba Code:
    program new;

    var
      bmp,x,y : Integer;

    begin
      bmp := BitmapFromString(28, 31, 'meJx1VQk8lFsbf7XxFS2WhjG2EV' +
            'KKui2Urovbvd3QclOX9nsL8ZEuKZKlhVCUJS0qbhIVyVJEKEXEWIc' +
            'sw1hmMBhqLLO8y/nOO/Tdut/ve3//3/md9znP+T/PeZ7/e967PcPp' +
            'PH5CY8XKA3YZ9W/7wMQwGOeCsYKRjy/B6OG8XKvUF7pxuQp+92fuP' +
            'S/z/WFEZyMyT6O6pkUw+pkgCACABBVzulmXgk93dTJ9Ary0DbWS2v' +
            'oSmI20I79YXHHbfNU7prmkCky8QLv2Z0contwh53l49/sa8/xm1ej' +
            'CBb4P5h0Kl//JbYaBNTJbta6pc7BvCIhEAJOMcjtjQoNbmhjegafU' +
            'l2o/aB/QcdhtGnR0RYADzWvHmkj3zXf8HbKjZh8zVT67C3Hataeqz' +
            'qF13OwVRzu+jBKQoeQSLW/rOdvEBpHXZNSzxvkCMDbGbqyNCPTtaG' +
            'vwOP2n1gqDJ7yxlHYWxdbC6NgOVSfrBS4Wc5xM5V3NZfYaz3fegmy' +
            '33vm6Yks5+2A32FTQtyShQuncEwX32Hm7fOZu2DNTdcWrEgavh9f9' +
            '8WNEkD+7o+nPgNOqBrpxrT0Z/cO5fZwFP6438thlHun8XdwfOud3K' +
            'B3dtNTvMMX7uH1RxZr0Sqt3POc+YPayxzC1Tiksc86/o+X3Bipa/i' +
            '5H35BbwqiqrvP1PtHcWHUywJu2lB7S2BbP6s0cHU9mdShYrf051N3' +
            'uUeC2rHOwFL/En0Osrbc9K6VcfkxPLLMs5rgOgXWFXZrJlXNDn870' +
            'vDnL8dwMyyPy623vPS9y9TjGbHh/NtBriYHmpc6BqI6B2z0jz0aF2' +
            'b3dcy1XW8R4/fo41PjMQdntVgl8wb6CGsQtTCEkjXbj5bqcBvuPIr' +
            'PiLoNHNepxrxTPpix0jVKw96TaOG5zciksLTru7WawTMertjOwsfd' +
            'KW39Kv+A5X5A1wFXcvnlHTKiMtWnKMO8aZ9C5rEk38oFufNaqh28t' +
            'cuu3vWH9Wta1tYS1KavO8E6RVsQTDf+bak7+FBuHK+nZBzxPaOvr7' +
            'S+q93jfEljbea2Fk9Y3UiAQ5vAGFW22ZvL5t7u5YW1cz5oOh2Lm9+' +
            'nv9OKf6d/I0ruerhWZohaetCjknlzAHRmfeDmf6/Ie4VTnAJq9k+X' +
            'v7kq6hh51HL+mgQtNfRFNvbfbuKm9vOwhfs7wSGrfYByr91Ir17OK' +
            '9durhp9zqlYm5enfzdG+ka52LYUSmaQYnqhwIWluYKKs311Zr7h5b' +
            'pepLueXOLjKG67eXVh/6DXTs7ItsIYdwey62c5JZHMy+IIb7T3RLK' +
            '4vg+VW3rq/uHlnYaNlbqVp5jvjRyWGD/INErN1bmbQop9Ro7JUwjL' +
            'mnv1LJShN+USs+j5vRH/12vv51ulv7J9XOuSWHX5edrzog39FfUhd' +
            'a0B1k3NBuWPuW5vHxVZpJSZ3cpcnZNHjM1RjHitHPVQMv7fwYoJCY' +
            'KLC2fvzA5IVAlJlfZMXeSco7zuFGJk5VLD3f+hxqe070cjzbx0OYX' +
            '+K4k5cHxRHcsYvdIycaeV7MgeP1Q4crOTsLu3cXtLxU0G7VV6zVU7' +
            'ND0+rzVMZG1NqTG6VaoVlLfRPVfZOWAw56cbmT6stsxk/ZjHsXtTb' +
            'v2zYk193oLDhUBETAs7t8+u3ZlXb5TO/f/TBIq3W7D5j+e0K/dgSv' +
            'ag8vfAc7ZBs+vlnS4Ifafol0Xz+UjoSprHHXX7lRppPhP7ZmCVnru' +
            'n5XzU+F7v24o2Nl25tCL25/sL1DWG3TIJilgfGLg2I1T8Tp+15TdM' +
            '9erHrVRXnyxSXUFWnkEWHLi7aF7TY0ZfieOpfW12VbJ1VzG1mULQQ' +
            '9a+h+RVoCI0mnUiXqNoIjY6o6iCqmghNG9HQQGiaiBodoRogFG2Eq' +
            'otQ9RCKphxVXQJvvy8QkSAgJNPAIKYsUkAfAiUn6CQQj4OJSSAaB4' +
            'SAICYBEGDYGABwggIMI93BFHDwDVApvjGiACegkRACkYS8N4VCXER' +
            '6YgAlwARGZiWWxiW9CTA9fgVcim+MGOmGkwmjkBYlY2LgCwMcxAQu' +
            'InAhhpPOAPxz/AfAV3GnKkDgEviOiQEK73kCQ6c84Dss2v9/viace' +
            'nB8agESTBJAREzzgCkzmbYYxfFJCfqlaIQ0Y0I6+buG38bAMFwMjf' +
            'DYn1EwKpQWB8fwqVV8DBDj5IT478bptP6XjewCLt1ONlaEw75KwJg' +
            'EHD0ehMjMQmYgsxCZeTIy82WQyPNnpg9GEFKyv88p1cxUXmQFIWH/' +
            'CNDQWdNYVQzAJ8iOSoAEA1A8fEAMTY6toxuw31aSDKiE7BROTP2jp' +
            '1Ml+XEhAQTol3BQpRjo5gF1zQ0sRgEAPACbg8HCYVCc3UDMJ9BNWs' +
            'v63zCgkdQ5QYIzPPTHSR9EZiaCIG477eAWmMAQAbbY2s1GELmZSFJ' +
            'isgrVEkFUNOYgJ/askh4fxsMmgIQDQJ9IbE5bwX1dBzMSEKClnScr' +
            'S4FlHSBPAUs0Zk5X764o/zwJzG0dT/n7Sb8toWgS4/KAhroZtz4fg' +
            'G6yqmQXYJ4YySmUmNOMu4rqoQwGxJjGYr3MB7kCMUgvrEFkEWQOoj' +
            'wL6XxfxWaOUBYv44/AHSOkPFDAHQbqWuaNVQXS+OS3AwsnAIANiH4' +
            'JbkYz6ipt4uOgsr3HmKIFevrrm4cU1Fa1D/cS4JPLbzas8qrWBj5V' +
            'deXQcA8An8lUUdA9BJQ1TJkM2KMhUkooCmUAS9QLAFeEQs72oroRD' +
            'NR2D6yi0kHvQF5xrYaRxaBI0MmuNaEuaCl/z0fBmi2OwcHBAEwAMA' +
            '6l3jsC1OjrWhh5kEOqKLJ/AhyFnF0CsZnmSk5pI+wqd1yooqKTlpw' +
            'Nz/6DrQMU2SoT/f1brBvLK2CD2BNAQ5MujyCKM5DMh/ehwp09A+bP' +
            'RlwcN0nvCVJ48PYZhjoQ4t9pGbW/qQHSO4TZ0S+7gPYfG9nHAw==');

      if FindBitmapIn(bmp, x, y, 25, 0, 500, 753)  then
      begin
          Writeln('Found at ('+toStr(x)+','+toStr(y)+')');
          MoveMouse(x, y);
          ClickMouse(x, y, 1);
          Wait(3000);
      end else
        writeln('Failed to find the bitmap...');

      FreeBitmap(bmp);
    end.

    Also I changed your ye parameter from 1071 to 753 since apparently over 754 is out of bounds. Also if I may suggest, I'd go with a DTM as opposed to bitmaps for the substantially less memory they use, depending on how you create it.

    Edit:
    I guess I misread your OP. The problem you're having is this part right here:
    Simba Code:
    if FindBitmapIn(Icon, x, y, 25, 0, 500, 1071)  then
          writeln('Found it!');
          Writeln('X ', x, '  Y ', y);
          MoveMouse(x, y);
          ClickMOuse(x, y, 1);

    Using an if...then statement will only apply the the exact following line of code (unless using begin & end), which in this case is only writeln('Found it!');. So in your case, whether the bitmap is found or not, these lines will still be executed by the script:
    Simba Code:
    Writeln('X ', x, '  Y ', y);
          MoveMouse(x, y);
          ClickMOuse(x, y, 1);

    I hope that makes sense.
    Last edited by Flight; 12-17-2017 at 08:05 PM.

    Current project:
    [Scripts / AeroLib Rev. 2]


    Did you know?
    J1407b, dubbed "Saturn on steriods", has a ring system 200 times larger than Saturn's own rings.
    #teampixel

  5. #5
    Join Date
    Apr 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    Amazing, thanks very much for doing that Flight! Yeah it makes sense. I will have to look into how to script the statements properly. I haven't tackled DTM's yet but they are next on my list . Thanks for the heads up about the dimensions, will sort those out!
    Last edited by Fidget; 12-17-2017 at 09:29 PM.

  6. #6
    Join Date
    Feb 2013
    Location
    Narnia
    Posts
    615
    Mentioned
    8 Post(s)
    Quoted
    252 Post(s)

    Default

    Quote Originally Posted by Fidget View Post
    Amazing, thanks very much for doing that Flight! Yeah it makes sense. I will have to look into how to script the statements properly. I haven't tackled DTM's yet but they are next on my list . Thanks for the heads up about the dimensions, will sort those out!
    You will find DTM's to be executed in similar ways, check out this video. And as Flight said, if you want an 'if' statement to execute multiple things, you will need a 'begin' and 'end'. I'm guessing he changed the ye value because his monitor is smaller than yours.

    View my OSR Script Repository!


    Botted to max
    Guides: How to Report Bugs to the Scripter
    ~~~~ Moved to Java. Currently Lurking ~~~~

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
  •