Results 1 to 11 of 11

Thread: Script Crashes chrome after a couple of hours

  1. #1
    Join Date
    May 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default Script Crashes chrome after a couple of hours

    Guys my simba script has been crashing chrome, it only happens after 2 - 3 hours have past. I noticed that simba will he hogging up memory when I wake up. I get this warning message that the minimap mask has not been released can someone help me with this?


    Code:
    program SetSail;
    {$I SRL-6/SRL.Simba}
    var
     glitchCount, c, d, i: Integer;
     arP: TPointArray;
    
     const
      BUNKERTYPE = 'any'; //cheap or any
      SETSAILS = 1; //how many times you want the bot to try to send your boats off before it buys bunker
    
    procedure DirtyWork;
    var X, Y, a, b: Integer;
    begin
      if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then   //1
      begin
        wait(600);
        Mouse(691, 793, 4, 4, MOUSE_LEFT);
        wait(3000);
        Mouse(660, 255, 4, 4, MOUSE_LEFT);
        writeln('Ships sent off, waiting');
        wait(gaussRangeInt(50000, 130000));
        Mouse(652, 273, 4, 4, MOUSE_LEFT);
        wait(3000);
       end else
      begin
        writeln('No ships to send out, waiting');
        wait(gaussRangeInt(50000, 130000));
        Mouse(652, 273, 4, 4, MOUSE_LEFT);
        wait(3000);
       end;
    end;
    
    procedure sendFirstFleet;
    var X, Y: Integer;
    begin
      if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then  //1
      begin
        wait(600);
        Mouse(691, 793, 4, 4, MOUSE_LEFT);
        wait(gaussRangeInt(1000, 3000));
        Mouse(660, 255, 4, 4, MOUSE_LEFT);
        wait(gaussRangeInt(1000, 2000));
        writeln('Ships sent off waiting 3 mins');
        Mouse(652, 273, 4, 4, MOUSE_LEFT);
        wait(gaussRangeInt(1000, 3000));
       end else
      begin
        writeln('no ships');
      end;
    end;
    
    procedure glitchCheck;
    var X, Y, a, b, i: Integer;
    begin
    if not(FindColor(X,Y, 9272929,617, 378, 666, 398))then
      begin
        Inc(glitchCount);
        wait(1000);
        Mouse(649, 270, 4, 4, MOUSE_LEFT);
        if(glitchCount <= 1)then
          begin
            writeln('fixed '+ IntToStr(glitchCount) +' glitch');
          end else
          begin
            writeln('fixed '+ IntToStr(glitchCount) +' glitches');
          end;
        wait(gaussRangeInt(3000, 5000));
      end else
        writeln('No glitch');
    end;
    
    procedure buyBunker;
    var x, y: Integer;
    begin
       Mouse(853, 271, 4, 4, MOUSE_LEFT);
       wait(gaussRangeInt(1000, 3000));
       If(BUNKERTYPE='any')Then
        begin
        Mouse(725, 334, 4, 4, MOUSE_LEFT);
        wait(gaussRangeInt(1000, 1500));
        repeat
        Mouse(855, 377, 4, 4, MOUSE_LEFT);
        SendKeys(IntToStr(gaussRangeInt(100, 400)), 155, 155);       // random number between 100 and 400
        wait(gaussRangeInt(1000, 1500));
        Mouse(865, 434, 4, 4, MOUSE_LEFT);
        wait(gaussRangeInt(1000, 1500));
        until(FindColor(x,y, 11857918,858, 456, 909, 488));
        Mouse(913, 262, 4, 4, MOUSE_LEFT);
     end;
    end
    
    function AutoColor: Integer;
    var
    
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetToleranceSpeed;
      SetColorToleranceSpeed(1);
    
      FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
       SetColorToleranceSpeed(tmpCTS);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);
    
        if (H >= 55.54) and (H <= 56.25) and (S >= 35.46) and (S <= 57.23) and (L >= 36.45) and (L <= 42.18) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);
    
          if (X >= 10.56) and (X <= 15.39) and (Y >= 12.35) and (Y <= 17.63) and (Z >= 21.54) and (Z <= 40.13) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;
    
      SetColorToleranceSpeed(tmpCTS);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    begin
    AutoColor;
    
    repeat
     if (i = SETSAILS) then
       begin
         buyBunker;
         i := 0;
       end;
      glitchCheck;
      wait(gaussRangeInt(1000, 1500));
      //FuelTheShips;
      sendFirstFleet;
      wait(gaussRangeInt(1000, 1500));
      glitchCheck;
      sendFirstFleet;
      wait(gaussRangeInt(1000, 1500));
      glitchCheck;
      //FuelTheShips;
      DirtyWork;
      glitchCheck;
      wait(gaussRangeInt(1000, 1500));
      Inc(i);
      until( false );
    end.

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Maybe try to draw the client when the script crashes and see what is happening

    Simba Code:
    Procedure drawClient();
    var
      bmp, w, h:integer;
    begin
      getClientDimensions(w, h);
      bmp := bitmapFromClient(0, 0, w-1, h-1);
      DisplayDebugImgWindow(w, h);
      DrawBitmapDebugImg(bmp);
      freebitmap(bmp);
    end;

    In your mainloop add

    Simba Code:
    addOnTerminate('drawClient');

  3. #3
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    So chrome crashes, because memory is stacking inside a Simba? I usually see memory leaks caused by bitmaps, DTMs, plugins or some tricky custom types. I can't see anything like this in your script, anything which would give a chance of leaking.

  4. #4
    Join Date
    May 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Yah the crashes only started after I added SRL support to my script. I am getting this message though

    The following bitmaps were not freed: [Minimap Mask]

  5. #5
    Join Date
    May 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by rj View Post
    Maybe try to draw the client when the script crashes and see what is happening

    Simba Code:
    Procedure drawClient();
    var
      bmp, w, h:integer;
    begin
      getClientDimensions(w, h);
      bmp := bitmapFromClient(0, 0, w-1, h-1);
      DisplayDebugImgWindow(w, h);
      DrawBitmapDebugImg(bmp);
      freebitmap(bmp);
    end;

    In your mainloop add

    Simba Code:
    addOnTerminate('drawClient');
    Whats that do? My script never crashes. only chrome.

  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by newguy45 View Post
    Whats that do? My script never crashes. only chrome.
    Maybe constantly call this in your script:

    Simba Code:
    Procedure drawClient();
    var
      lastScreen, w, h:integer;
    begin
      getClientDimensions(w, h);
      if isTargetValid() then // target valid so we will take a screenshot of the client
      begin
        if bitmapExists(lastScreen) then
          freebitmap(lastScreen);
        lastScreen := bitmapFromClient(0, 0, w-1, h-1);
        DrawBitmapDebugImg(lastScreen);
      end else // target not valid so we will terminate the script and show a screenshot of the last time the client was valid
      begin
        freebitmap(lastScreen);
        DisplayDebugImgWindow(w+1, h+1); // throws a error here when the script terminates for some reason.. whatever though
        terminateScript();
      end;
    end;

    It will take a screenshot of your selected client, and if the client crashes the script will terminate and display a screenshot of the last time the client was shown (so maybe you can see if it is something on chromes end)

  7. #7
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Unrelated Q: why not use Appa?
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  8. #8
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Unrelated Q: why not use Appa?
    I don't think it supports the newer versions of flash with most facebook games require
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

  9. #9
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by newguy45 View Post
    Yah the crashes only started after I added SRL support to my script. I am getting this message though

    The following bitmaps were not freed: [Minimap Mask]
    I don't see SetupSRL(); in your script. So theoretically none of SRL stuff should be initialized? @Olly

  10. #10
    Join Date
    May 2006
    Posts
    120
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by bg5 View Post
    I don't see SetupSRL(); in your script. So theoretically none of SRL stuff should be initialized? @Olly

    yah, Originally I had SetupSRL(); in it but it was complaining about SMART bot being initialized and it waits 5 minuets for rs to load

  11. #11
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by newguy45 View Post
    yah, Originally I had SetupSRL(); in it but it was complaining about SMART bot being initialized and it waits 5 minuets for rs to load
    Were you
    Simba Code:
    {$define smart}
    -ing too? You can include SRL-6 and not define SMART. It might still look for an RS client, but you can figure out which procedure does the waiting and override it to always return true. I'd elaborate but I don't have Simba & SRL handy to test with.

    E: Just searched the repo, it's waitClientReady()

    So
    Simba Code:
    function waitClientReady(): boolean; override;
    begin
      exit(true);
    end;

    I guess that's the easiest way to initialize SRL-6 without it looking for RS.
    Last edited by KeepBotting; 04-11-2015 at 09:50 PM.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

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
  •