Results 1 to 9 of 9

Thread: 'Access violation' Problem

  1. #1
    Join Date
    Jun 2007
    Location
    Belgium - Eke
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default 'Access violation' Problem

    I'm making a script that does some woodcutting.
    I have included the SRL/SRL/skills/Woodcutting.scar file in my script.
    When I use the FindAxe function, i always get this error:
    Code:
    [Runtime Error] : Exception: Access violation at address 007233EC in module 'scar.exe'. Read of address 0000001C in line 86 in script C:\Program Files\SCAR 3.12\includes\SRL/SRL/skill/Woodcutting.scar
    The code at line 86 is
    Code:
    FreeDtm(dtmAxes[i]);
    When I start the script I choose "permit access to this folder".

    Helpzz plx!
    Thx!

  2. #2
    Join Date
    Aug 2007
    Location
    Vancouver
    Posts
    394
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    do you have

    SCAR Code:
    {.include SRL/SRL.scar}

    and

    SCAR Code:
    SetupSrl;//main loop

  3. #3
    Join Date
    Jun 2007
    Location
    Belgium - Eke
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes

  4. #4
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You can't free anything you haven't loaded

    It would help if you'll post all code
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  5. #5
    Join Date
    Jun 2007
    Location
    Belgium - Eke
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is my script. It's far from finished. Thx for helping me !
    I don't post the includes, you know where to find them

    Code:
    program Trifonius;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/skill/Firemaking.scar}
    {.include SRL/SRL/skill/Woodcutting.scar}
    
    var
    x,y,i : Integer;  //i is used for Iterations
    FoundTB,FoundLogs : Boolean;  //Used for finding/locating the items
    TB: Tbox;  //Used for finding TinderBox
    
    procedure DeclarePlayers;
    begin
      //How many players do you want to use?
      //Replace the 1 with the correct amount
      NumberOfPlayers(1);
      CurrentPlayer := 0;
    
      { -==- Player 1 -==- }
      Players[0].Name      := '';
      Players[0].Pass      := '';
      Players[0].Active    := true;
    end;
    
    procedure CutWood;
    begin
      FindAxe; //<==== The problem! ====>//
    end;
    //end Cutwood;
    
    procedure MakeTheFire;
    begin
      SetupFiremaking;  //Loads the Firemaking bmp's (Fire, TinderBox, LogMask) Unload?
      FoundTB:=true;  //Resets the FoundTB
      FoundLogs:=true;   //Resets the FoundLogs
      GameTab(4);  //Makes sure the inventory is open
      if(CountItemBmpMaskTol(TinderBox,10,10)=0) then //Checks for TinderBox
      begin
        Writeln('Could not find TinderBox');
        FoundTB:=false;   //Script ends here
      end;
    
      if(FoundTB=true) then  //Only when TinderBox is found
      begin
    
        if(CountItemBmpMaskTol(LogMask,10,10)=0) then //Checks for Wood
        begin
          Writeln('Could not find Logs, lets make some');
          CutWood;  //No logs in inventory, start CutWood procedure!
          FoundLogs:=false;
        end;
    
        if(FoundLogs=true) then  //There are logs in the inventory
        begin
          WeHaveLogs( x, y);  //Firemaking.scar function, returns x and y of logs
          MMouse( x+15, y+15, 0, 0);Wait(500+random(100));
          ClickMouse( x+15, y+15, false);Wait(500+random(100));
          MMouse( x+15, y+15+25, 0, 0);Wait(500+random(100));
          ClickMouse( x+15, y+15+25, true);Wait(500+random(100)); //Logs are being used now
          FoundTB:=false;  //Resets the FoundTB to use in the while loop
          while(FoundTB=false) do  //Here FoundTB is used to search the TinderBox' posistion in the Inventory
          begin
            TB := InvBox(i);
            if ExistsItem(i) then  //TinderBox inventory position found
            if FindBitmapMaskTolerance(TinderBox, x, y, TB.x1, TB.y1, TB.x2, TB.y2, 10, 10) then  //x and y of TinderBox is now stored in x and y
              FoundTB:=true;
          end;
          MMouse(x+15,y+15,0,0);Wait(500+random(100));
          ClickMouse( x+15, y+15, true);Wait(500+random(100));  //Make fire! Clicks TinderBox
        end;
      end;
    end;
    //end MakeTheFire
    
    begin
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      MakeCompass('n');
      HighestAngle;
      MakeTheFire;
    end.

  6. #6
    Join Date
    Jun 2007
    Location
    Belgium
    Posts
    333
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmmm, no problem on my end

  7. #7
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You'll need SetupWoodcutting; after SetupSrl
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  8. #8
    Join Date
    Jun 2007
    Location
    Belgium - Eke
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thx alot!

  9. #9
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Or just copy FindAxe to your script and remove the FreeDTM. DTM's do not need to be free-ed (they can, but not freeing them won't cause that much lagg). Remove the .include Woodcutting, and then just use FindAxe directally from your script.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Access Violation
    By Macho Man67 in forum OSR Help
    Replies: 1
    Last Post: 09-16-2008, 04:09 AM
  2. Access Violation Problem
    By wand2658 in forum OSR Help
    Replies: 1
    Last Post: 07-24-2008, 07:36 AM
  3. More Access Violation
    By Mute in forum OSR Help
    Replies: 2
    Last Post: 11-19-2007, 08:00 PM
  4. Access Violation
    By Mute in forum OSR Help
    Replies: 5
    Last Post: 11-18-2007, 01:32 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
  •