Results 1 to 19 of 19

Thread: Exception in Script: Runtime error: "You passed a wrong ye to a finder function: 1040

  1. #1
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Question Exception in Script: Runtime error: "You passed a wrong ye to a finder function: 1040

    "Exception in Script: Runtime error: "You passed a wrong ye to a finder function: 1040. The client has a height of 1018, thus the ye is out of bounds." at line 208, column 28"

    This is what I've been getting after I converted a script of mine from SRL5 to SRL6. This happens because I set the script to look for SkyBoxes on the coordinates (DivinationWispX-10, DivinationWispY, DivinationWispX+300, DivinationWispY+300) and sometimes these coordinates go out of bounds. On SRL5, the coordinates would be rounded down so as to fit in the client, which made my script perfect, since the skyboxes also have its coordinates rounded down. How can I make SRL6 do it, also, instead of adding a bunch of conditions like 'if DivinationWispY+300 > BoundY then CoordinateToFindSkyBox = BoundY'?
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  2. #2
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    I gave up on SRL-6. I really won't add lines over lines of conditions so as to avoid any coordinate that goes beyond the client bounds. My scripts won't work if the coordinates gets rounded, and what finally made me give up was that a function of SRL-6 itself put a coordinate off the script and for that reason it didn't work:

    Simba Code:
    function didClick(Red: Boolean; Time: Integer = 1000): boolean;
    var
      TimeOut, x, y, w, h, R, G: integer;
      B: TBox;
    begin
      fastClick(MOUSE_LEFT);

      GetMousePos(x, y);
      GetClientDimensions(w, h);
      B := IntToBox(x - 15, y - 15, x + 15, y + 15); //It was probably this that got a coordinate off.

      if (B.x1 < 0) then B.x1 := 0;
      if (B.y1 < 0) then B.y1 := 0;
      if (B.x2 > w) then B.x2 := w;
      if (B.y2 > h) then B.y2 := h;

      TimeOut := GetSystemTime() + Time;

      while (GetSystemTime() < TimeOut) and (not Result) do
      begin
        R := CountColorTolerance(395675, B.x1, B.y1, B.x2, B.y2, 15);
        G := CountColorTolerance(1695663, B.x1, B.y1, B.x2, B.y2, 15);

        if Red then
        begin
          if (G > 8) then
            Exit(false);

          Result := (R > 20);
        end else
        begin
          if (R > 5) then
            Exit(false);

          Result := (G > 35);
        end;
      end;
    end;

    I feel that it is so much easier to script on SRL5 '-'
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  3. #3
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    I don't get it... How was it easier to stop Simba to not search outside the clients bounds on srl-5?

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

    Default

    @archermaths;

    You're comparing apples to oranges. The did click function has a check:

    Simba Code:
    if (B.x1 < 0) then B.x1 := 0;
      if (B.y1 < 0) then B.y1 := 0;
      if (B.x2 > w) then B.x2 := w;
      if (B.y2 > h) then B.y2 := h;

    Does your function check and see if the search box is out of bounds?
    (show code)

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

  6. #6
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    @archermaths;

    You're comparing apples to oranges. The did click function has a check:

    Simba Code:
    if (B.x1 < 0) then B.x1 := 0;
      if (B.y1 < 0) then B.y1 := 0;
      if (B.x2 > w) then B.x2 := w;
      if (B.y2 > h) then B.y2 := h;

    Does your function check and see if the search box is out of bounds?
    (show code)
    No, my I didn't put any function to check, since I didn't need to on SRL5 and I'm just converting my scripts from SRL5 to SRL6. It's exactly those 5 lines of scripting (considering GetClientBounds) that I don't want to add to many parts of my script. I know how to fix it, but since it has been easier with SRL5, I might use SRL5 until I stop being lazy >.> My script is already a mess due to my lack of experience on making things shorter. Even I have some kind of difficulty reading my own script, imagine if I write like 100 (5 lines x ~20 times I want to draw boxes) more lines that I wouldn't have to on SRL5? Maybe later '-'
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  7. #7
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Are to trying to draw the boxes on smart?
    No, I'm trying to draw boxes on a client I set SIMBA to work on. Specifically, it is the Runescape client.
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  8. #8
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    I don't get it... How was it easier to stop Simba to not search outside the clients bounds on srl-5?
    Using SRL5, this is what happens when I ask him to

    Simba Code:
    program new;
    {$i srl/srl.simba}

    var
    x, y: integer;

    Begin
      SetupSRL;
      FindColorTolerance(x, y, 1245, 1, 1, 10000, 10000, 5);
    end.

    Progress Report:
    Compiled successfully in 421 ms.
    SRL Compiled in 16 msec
    Warning! You passed a wrong xe to a finder function: 10000. The client has a width of 1906, thus the xe is out of bounds. Setting the value to 1905 (w-1) for now.
    Warning! You passed a wrong ye to a finder function: 10000. The client has a height of 764, thus the ye is out of bounds. Setting the value to 763 (h-1) for now.
    Successfully executed.


    This made a natural failsafe for when any coordinate went out of bounds. It seems to me as if, in any case, this would be helpful. At least it doesn't interrupt the script.

    [EDIT] Forgot to say that the SRL6 instantly interrupts the script if there is a coordinate out of bounds.
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  9. #9
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by archermaths View Post
    No, I'm trying to draw boxes on a client I set SIMBA to work on. Specifically, it is the Runescape client.
    So I'll take that as a yes? Just put it in a try..except.

  10. #10
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    What I was thinking on doing was to change functions on their core.

    Simba Code:
    function findColorTolerance(var x, y: Integer; color: integer; searchBox: TBox; tol: Integer; settings: TColorSettings): Boolean; overload;
    var
      cs: TColorSettings;
    begin
      cs.retrieve();
      settings.apply();
      Result := findColorTolerance(x, y, color, searchBox, tol);
      cs.apply();
    end;

    I could insert conditions in that function just to check if the given TBox is on bounds. But this would require to change every Color, DTM, bitmap and other functions like those, and their bunch of Overload functions... But this could work on a script that uses 1 color function intensively. Well, there are some ways to fix it; all of them are quite boring '-'
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  11. #11
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    So I'll take that as a yes? Just put it in a try..except.
    Oh it could make things easier :O I can think on something useful to put on the Except part. I like this, it seems better than adding failsafes against coordinates out of bounds everywhere in my script! Thanks but I still would love round ups and downs >.> Round ups and downs would allow me to successfully find stuff that actually exist and are on the edge of the client, while Try..Except will make me put it to find the same stuff on different parts. This narrows my possibilities, but seems very handy.
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  12. #12
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by archermaths View Post

    [EDIT] Forgot to say that the SRL6 instantly interrupts the script if there is a coordinate out of bounds.
    From what I understand there isn't a difference between SRL5 and SRL6. Your script will only terminate if you try to draw something on the SMART canvas which is out of bounds (which is why I asked you before). If you are simple searching for a color within a box that is out of bounds, it will adjust your coordinates, just like srl5 (so I don't know what you are trying to do?). Output from SRL6:

    Code:
    Warning! You passed a wrong xs to a finder function: -20. That is below 0, thus out of bounds. Setting the value to 0 for now.

  13. #13
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    SmartImage.drawClippedBox();

  14. #14
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by archermaths View Post
    No, I'm trying to draw boxes on a client I set SIMBA to work on. Specifically, it is the Runescape client.
    Specifically? You cannot do this atm. Not until the Simba that exports the GetWindowHandle function is pushed. You can compile Simba's source or use the buildbot to do it.. Then you can use the WindowHandle to do some of the following:

    Minimize or bring windows to the foreground.
    Draw on any window.
    Resize any window.
    Use WinAPI functions.
    Get Process information.
    Screenshot that specific window.
    Inject into that window's process.


    etc.. Most of which requires a plugin or enabling system api calls.
    I am Ggzz..
    Hackintosher

  15. #15
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    SupressExceptions are turned on in SRL-6 so i'm not sure why Simba is raising a exception for searching outside of client bounds. And as others have said you can't just draw onto any client other than SMART (unless you use some sort of plugin).

  16. #16
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    From what I understand there isn't a difference between SRL5 and SRL6. Your script will only terminate if you try to draw something on the SMART canvas which is out of bounds (which is why I asked you before). If you are simple searching for a color within a box that is out of bounds, it will adjust your coordinates, just like srl5 (so I don't know what you are trying to do?). Output from SRL6:

    Code:
    Warning! You passed a wrong xs to a finder function: -20. That is below 0, thus out of bounds. Setting the value to 0 for now.
    Noooooooooo, Sorry, 'draw' wasn't even nearly the correct word. I don't know what to say, to be honest. FindColorTolerance, for example, finds colors inside a box, defined by the given coordinates. Those are the boxes I'm doing. Well, sorry for causing this confusion. I'll reproduce my problem in a simple script:

    Simba Code:
    program new;
    {$I SRL-6/SRL.simba}

    var
      x, y: integer;

    begin
      FindColorTolerance(x, y, 1234, 1593, 274, 1720, 449, 5);
    end.

    Progress Report:
    Compiled successfully in 1061 ms.
    Exception in Script: Runtime error: "You passed a wrong xe to a finder function: 1720. The client has a width of 1602, thus the xe is out of bounds." at line 8, column 21
    The following bitmaps were not freed: [Minimap Mask]


    So, an example in my script:

    Simba Code:
    if FindColorsSpiralTolerance(960, 515, WispTPA, 7234624, MMSX1, MMSY1, MMSX2, MMSY2, 10) or
      FindColorsSpiralTolerance(960, 515, WispTPA, 7234624, MMSX1, MMSY1, MMSX2, MMSY2, 10) then
      begin
        WispTPAA := TPAToATPAEx(WispTPA, 32, 32);
        SortATPASize(WispTPAA, True);
        MiddleTPAEx(WispTPAA[0], WispX, WispY);
        MouseSpeed := RandomRange(40, 46);
        Mouse(WispX, WispY, 1, 1);
        MouseSpeed := 25;                                                                                 //Move Mouse to the coordinates found
        T.start();
        repeat
          FindBitmapToleranceIn(bmpWispSkyBoxBitMap, x, y, WispX, WispY, WispX+300, WispY+300, 5); //THIS IS THE PROBLEM!!!!!!!!!!!!!!!!!!!

    The problem in this script of mine comes when the Divination Wisp is found near the edge of the screen, and then WispX+300, WispY+300 goes out of bounds, returning the same report as above.
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  17. #17
    Join Date
    May 2012
    Location
    Brazil, Rio de Janeiro.
    Posts
    160
    Mentioned
    2 Post(s)
    Quoted
    32 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Specifically? You cannot do this atm. Not until the Simba that exports the GetWindowHandle function is pushed. You can compile Simba's source or use the buildbot to do it.. Then you can use the WindowHandle to do some of the following:

    Minimize or bring windows to the foreground.
    Draw on any window.
    Resize any window.
    Use WinAPI functions.
    Get Process information.
    Screenshot that specific window.
    Inject into that window's process.


    etc.. Most of which requires a plugin or enabling system api calls.
    Sorry, I should have added the information on my post above earlier. I'm not trying to draw on the screen; what I meant was that some functions act in boxes, and I think I meant 'draw theoretical boxes' where it searches in it, but this was wrong due to the correct meaning of 'draw' >.> Really sorry.
    "If, at someone, your wound still arouses pity,
    stone this vile hand that strokes you,
    spit on this lips that kiss you." (Augusto dos Anjos, translated from brazillian portuguese to english)
    http://villavu.com/forum/image.php?type=sigpic&userid=96295&dateline=137947  1136

  18. #18
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    archermaths, I think there are a ton of simple solutions.

    Here is one... The logic is there, not tested so i could've made a stupid logic error.

    Simba Code:
    program new;
    {$I SRL-6/SRL.Simba}

    const
      CONST_MAX_WIDTH = 1000;
      CONST_MAX_HEIGHT = 600;
    var
      screenSearchArea: TBox;

    function TBox.clipIt: TBox;
    begin
      if (self.x1 < 0) then self.x1 := 0;
      if (self.y1 < 0) then self.y1 := 0;
      if (self.x2 > CONST_MAX_WIDTH) then self.x2 := CONST_MAX_WIDTH
      if (self.y2 > CONST_MAX_HEIGHT) then self.y2 := CONST_MAX_HEIGHT;
      result := self;
    end;

    var
      tpointsss: TPointArray;
      clientBounds: TBox := [0, 0, 1000, 600];
    begin
      findColorsTolerance(tpointsss, 1727723, screenSearchArea.clipIt, 7);//Searches in screenSearchArea constrained by the const max w and h
      findColorsTolerance(tpointsss, 1727723, clientBounds, 7);//searches in the client boundries
    end.

    there are other more elegant solutions, you take your pick

    here's an SRL function:
    Simba Code:
    procedure TBox.setLimit(b: TBox);
    begin
      if (self.x1 < b.x1) then self.x1 := b.x1;
      if (self.x2 > b.x2) then self.x2 := b.x2;
      if (self.y1 < b.y1) then self.y1 := b.y1;
      if (self.y2 > b.y2) then self.y2 := b.y2;
    end;

  19. #19
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    You need to call setupSRL(). Would have been the same with srl5.

    Or do setSupressExceptions(true);

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
  •