Acces Violation - The Last Straw

Discussion in 'Scar/Simba Help' started by Harukoten, Jul 22, 2008.

Acces Violation - The Last Straw
  1. Unread #1 - Jul 22, 2008 at 9:15 PM
  2. Harukoten
    Referrals:
    0

    Harukoten Guest

    Acces Violation - The Last Straw

    Hokai, so, I don't usually like to actively post my own question, I tend to just google the shiznits out of my question till I find a) an answer that works, or b) an answer to another question that can be applied to my problem, and fixes it. However, I have been unable to fix this one on my own, possibly because of my limited knowledge of Scar, I am rather new to it. So here I am.

    My problem involves random access violations. Straight up, I wont be posting my code in it's entirety, as I am planning on selling it down the line, or do some serious botting with it, so I apologize in advance.

    As I understand so far, access violations occur because something went wrong with the bitmap, so to speak, or something do with Scar's memory. I have tried to load my bitmap using two different methods, by directly assigning a variable a value using BitmapFromString(); This was done by using Scar's Picture To String ability, then copy pasting, I have also attempted to load the bitmap to it's variable using LoadBitmap(); using it's absolute address, I haven't tried relative, come to think of it...but I can't see that fixing the issue, which I will explain in a moment. I have a total of 6 bitmap images used in my script, I use both methods in my script and have tried both methods on the two specific bitmaps giving me issue.

    I figured there might be a problem with the .bmp image file, so I created a completely new one, new name, and a new location on my hard drive, just in case, and changed it slightly, nada.
    What REALLY makes me unable to figure this one out is that the access violation doesn't always happen, as of yet (over 50 complete begin-end program runs) I have been unable to find any pattern to the access violations. At first I thought they had something to do with the fact that the games sometimes lag, and therefore, the script can't find the image, but I added a (Wait 2000); to my script, enough to account for lag, and so I know that scar is not trying to find the image while lag is keeping them from appearing. I use FindBitmapIn() as my search method, might that have something to with it? I have also used FindBitmapToleranceIn(), but not on the two specific bitmaps that are having the issue, cause the bitmaps appear exactly as they are saved, never ANY variation, could there be a slight diff, and that cause an access violation, I figuired it would just cause the FindBitmapIn() procedure to just return false.

    Alright, and now for the final bit, my script HAS been able to able to load the image, search for it, find it, and continue the script without any errors, all 50 of the above mentioned trials were using the exact same code as I have when the violations occur, so I know its something else, cause my code works most of the time, and sometimes, schmuck, access violation.

    If all that was a lot, could someone just answer me this, what is the exact nature of an access violation, and what exactly calls an access violation, what its parameters, that kinda thing. If I knew what exactly one was, might help me, I haven't been able to find a clear concise definition of one yet.

    Sorry for this being so long, I'm not one much to dum down my speech when talking on the internet, I prefer proper words. And thank you in advance, this one has been giving me some issues, mainly cause I can't out

    To load my bitmaps:
    Code:
    rabidDog := LoadBitmap('C:\Documents and Settings\****\My Documents\My Pictures\RabidDog.bmp');
    serpentWoman := LoadBitmap('C:\Documents and Settings\****\My Documents\My Pictures\SerpentWoman.bmp');
    
    The two calls for them, both rabidDog and SerpentWoman have given me issues.
    Code:
    FindBitmapIn(rabidDog, xRabidDog, yRabidDog, xOne, yOne, xTwo, yTwo);
    FindBitmapIn(serpentWoman, xSerpentWoman, ySerpentWoman, xOne, yOne, xTwo, yTwo);
    
     
  3. Unread #2 - Jul 28, 2008 at 10:48 AM
  4. Harukoten
    Referrals:
    0

    Harukoten Guest

    Acces Violation - The Last Straw

    Alright, since this is going to be another large post, I'll make it a new one rather than edit my old, because this post answers most of what can go wrong in the first one. My apologies for double posting and all that.

    For those who are having access violation issues, check the following closely:

    Memory: Unless you have a LOT of bitmap's all loaded into memory, this is very unlikely to be the issue, any decent computer is not gonna run into this issue.

    Coordinates: This was what was causing them for me, so read this one carefully. If you have a bitmap search that slowly extends the range of the search every loop, make sure that the x and y coordinates can never exceed your desktop resolution. For Example:

    repeat
    xOne := xOne - 5;
    xTwo := xTwo + 5;
    yOne := yOne - 5;
    yTwo := yTwo + 5;
    until(FindBitmapIn(bitmapName, x, y, xOne, yOne, xTwo, yTwo));

    If ever XOne or yOne is less than zero, there is no desktop at those coordinates, and you get an access violation, and if ever xTwo or yTwo exceeds your desktops resolution, than it also returns a violation, this is what was happening to me.

    The access violations seemed random because they only occurred when my script couldn't find the bitmap, and so it kept expanding the search box coordinates, until it tried searching outside the desktop resolution limits. If it did find the bitmap, it never got to that point, so it never returned a violation.

    Hope this helps some people, any questions, just ask.
     
< What should I do for Scripts? | Logging in? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site