Results 1 to 8 of 8

Thread: Problems with script interpreter? Mousebox function randomly crashes?

  1. #1
    Join Date
    Aug 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default Problems with script interpreter? Mousebox function randomly crashes?

    Hey dev's.. I've discovered some weird issues and I don't know if it's SRL or Simba at fault here, please move this thread if this isn't the appropriate forum..

    I can't seem to get some functions to call when they are in the until(); bracket of a loop.. Here is an example of what I had to do to get findcolourtol to be called:

    Code:
      repeat
        z:= z + 1;
        SleepAndMoveMouse(384 + random(253));
        if (findcolortolerance(x,y,2340527,525, 445, 527, 447, 10)) then
        begin
          z:= 111;
        end;
      until(z >= 111);  //found colour
    This is the code which will compile but causes an endless loop:

    Code:
      repeat
        SleepAndMoveMouse(384 + random(253));
      until(findcolortolerance(x,y,2340527,525, 445, 527, 447, 10));  //never looks for colour
    I had another problem, but it is no longer present..
    I would also appreciate if a mod would remove the "Miserable user" status from my account, as happened with Wanted.. I don't think such an open-source-preaching community should be so closed-source with it's member structure anyway..
    Last edited by KM_01; 11-22-2013 at 12:16 AM.

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

    Default

    I can't explain your first problem; that's really odd. I've used loops that way plenty of times and it's always worked fine. You could write a wrapper, and add a writeln() to it, then you'll know for sure if it's being called. Add this above the function that your loop is in:
    Simba Code:
    function FindColorToleranceEx(x, y, color, x1, y1, x2, y2, tol: integer): boolean;
    begin
      Writeln('FindColorTolerance is being called.');
      Result := FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
    end;
    And call FindColorToleranceEx in your loop.

    Your second problem: MouseBox will not move the mouse if the mouse pointer is already in the box you want to move to. So if it moves there once, but doesn't find the "hover color", it won't move the mouse again, it'll just keep looking for the hover color. Maybe some more debugging will tell you whether or not the hover color is being found.

    Hope this helps,
    Coh3n

  3. #3
    Join Date
    Aug 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Thanks Coh3n, I'll add that debug to my script and see what's happening..
    On the mousebox issue, it actually does move the mouse when the pointer is already within the box (this happens 9.99 times out of 10), it mouses around within the defined box until it detects the hover colour..
    I suspected that it had something to do with the other findcolortol in the same loop which uses diff x and y vars, maybe it returned true for the hover color and (because there is only 1 wait() between findcolortol's) the first findcolortol is mis-interpreted as true from the end of the last loop.
    The interpreter error seems likely to be on my end, and not a problem with SRL or Simba.. I might re-install SRL completely and see if the issue resolves itself.. I haven't experienced the problem with mousebox in a long time also..

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

    Default

    Quote Originally Posted by KM_01 View Post
    On the mousebox issue, it actually does move the mouse when the pointer is already within the box (this happens 9.99 times out of 10), it mouses around within the defined box until it detects the hover colour..
    That's not supposed to happen. Does it move anywhere in the box, or just slightly move the mouse from the point it's already at (if the mouse is already in the box, I mean)?

  5. #5
    Join Date
    Aug 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    It seems to just move anywhere within the box (regardless of where the pointer already is).. I'm using an out-dated version of SMART too.. 8.3 is old now I think..
    Here is the method straight from my include, I see it is supposed to move within the box unless the pointer is already there.. I have no idea why it would be doing this for me and nobody else..
    Code:
        procedure mouseBox(b: TBox; button: integer = MOUSE_MOVE);
    
    Moves the mouse somewhere inside the box b. Will just move my default. Click
    depends on what button is set to.  It is more likely to click around the middle
    of the box.
    
    .. note::
    
        - by Coh3n
        - Last Updated: Mar. 17, 2013 by Coh3n
    
    Example:
    
    .. code-block:: pascal
    
        mouseBox(b, MOUSE_LEFT);
    *)
    procedure mouseBox(b: TBox; button: integer = MOUSE_MOVE; mmType: integer = MOUSE_HUMAN);
    var
      p: TPoint;
      x, y: integer;
    begin
      getMousePos(x, y);
    
      if (not pointInBox(point(x, y), b)) then // if the mouse is already in the box
      begin
        gaussBox(p, b);
        mouse(p, button, mmType);
      end else
        mouse(point(x, y), button, mmType);
    end;
    The spamming of "Detected bank chest" seems to verify that the method was working correctly because the mouse was just sitting and was recognised as being within the box (so mousebox won't move it).. But that only happened 0.01% of the time, mostly it would move within the box, failing to find the hover colour, it would re-position the mouse at random co-ords within the same box. Very unusual problem..
    Last edited by KM_01; 11-21-2013 at 02:20 AM.

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

    Default

    Odd. Can you run this code (drag your Simba crosshairs to anything). It should move the mouse once and sit there, which is exactly what it does for me.
    Simba Code:
    program new;
    {$i srl-6/lib/core/mouse.simba}

    begin
      clearDebug();

      repeat
        mouseBox(intToBox(0, 0, 300, 300), MOUSE_MOVE);
        wait(500);
      until(false);
    end.

    E: Also, are you still using the same code as in the OP?
    Last edited by Coh3n; 11-21-2013 at 04:00 AM.

  7. #7
    Join Date
    Aug 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Everything appears to be working normally, the mouse didn't move unless it was outside the defined box. I'm not sure what was happening last week in the script.. Now it won't move the mouse around once inside the box.
    Thanks for the assistance, Coh3n
    I'm going to update SMART and see if findcolortol() will work from inside an until() bracket.

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

    Default

    Quote Originally Posted by KM_01 View Post
    Everything appears to be working normally, the mouse didn't move unless it was outside the defined box. I'm not sure what was happening last week in the script.. Now it won't move the mouse around once inside the box.
    Thanks for the assistance, Coh3n
    I'm going to update SMART and see if findcolortol() will work from inside an until() bracket.
    Lol, weird. Well, I'm glad it's working again.

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
  •