Results 1 to 9 of 9

Thread: GetAmount out of range (line 120)

  1. #1
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default GetAmount out of range (line 120)

    Code:
    [Runtime Error] : Out Of Range in line 120 in script D:\RSCHEAT\scar\SCAR 3.20\includes\SRL/SRL/Core/Amount.scar
    and here's my function:
    edit: Narcles function, tbh
    SCAR Code:
    function GetArrowCount:integer;
    begin
      gametab(5);
      result := GetAmount(666, 249);
    end;
    Last edited by marpis; 05-15-2009 at 03:19 AM.

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    the error is in amount.scar, not in your script.

    I checked out that function, and at least in the opendev rev i see no thing which would cause such error.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    the error is in amount.scar, not in your script.

    I checked out that function, and at least in the opendev rev i see no thing which would cause such error.

    ~RM
    Im not so sure what rev i have, i think 32, but here's the function from amount.scar

    SCAR Code:
    {*******************************************************************************
    function GetAmount(ItemX, ItemY: Integer): Integer;
    By: ZephyrsFury
    Description: Returns the amount of an item at coordinates (ItemX, ItemY).
      Returns approximate values for 'K' and 'M'.
    *******************************************************************************}


    function GetAmount(ItemX, ItemY: Integer): Integer;
    var
      S: string;
      X, Y, Col, II: Integer;
      B: TBox;
      colPts: TPointArray;
      ATPA: T2DPointArray;
    begin
      if (FindColor(X, Y, 65536, ItemX - 10, ItemY - 10, ItemX + 10, ItemY + 10)) then
      begin
        Result := 1;
        for II := 2 downto 0 do
          if (FindColorsTolerance(colPts, 7575987 * II * II - 6796134 * II + 65535, ItemX - 20, ItemY - 30, ItemX + 20, ItemY + 10, 0)) then
            Break;
        if (II > 2) then Exit;
        ATPA := SplitTPAEx(colPts, 5, 5);
        SortATPASize(ATPA, True);
        colPts := ATPA[0];
        Col := 7575987 * II * II - 6796134 * II + 65535;
        B := GetTPABounds(colPts);
        S := Trim(GetTextAtEx(B.X1, B.Y1 - 1, 0, StatChars, False, False, 0, 1, Col, 5, True, tr_AllChars));
        Result := StrToIntDef(GetNumbers(S), 1);
        if (Pos('M', S) > 0) then Result := Result * 1000000;
        if (Pos('K', S) > 0) then Result := Result * 1000;
      end;
    end;

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    function GetAmount(ItemX, ItemY: Integer): Integer;
    By: ZephyrsFury
    Description: Returns the amount of an item at coordinates (ItemX, ItemY).
      Returns approximate values for 'K' and 'M'.
    *******************************************************************************}


    function GetAmount(ItemX, ItemY: Integer): Integer;
    var
      S: string;
      Col, II: Integer;
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      if (FindColorsTolerance(TPA, 65536, ItemX - 50, ItemY - 50, ItemX + 50, ItemY + 50, 0)) then
      begin
        ATPA := SplitTPAEx(TPA, 5, 5);
        SortATPAFromFirstPoint(ATPA, Point(ItemX, ItemY));
        B := GetTPABounds(ATPA[0]);
        if (Length(ATPA[0]) < 15) or (B.X2 - B.X1 < 5) or (B.Y2 - B.Y1 < 5) then Exit;
        Result := 1;
        for II := 2 downto 0 do
          if (FindColorsTolerance(TPA, 7575987 * II * II - 6796134 * II + 65535, B.X1 - 10, B.Y1 - 10, B.X2 + 10, B.Y2 + 10, 0)) then
            Break;
        if (II < 0) then Exit;
        ATPA := SplitTPAEx(TPA, 5, 5);
        SortATPAFrom(ATPA, Point((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1));
        TPA := ATPA[0];
        Col := 7575987 * II * II - 6796134 * II + 65535;
        B := GetTPABounds(TPA);
        S := Trim(GetTextAtEx(B.X1, B.Y1 - 1, 0, StatChars, False, False, 0, 1, Col, 5, True, tr_AllChars));
        Result := StrToIntDef(GetNumbers(S), 1);
        if (Pos('M', S) > 0) then Result := Result * 1000000 else
        if (Pos('K', S) > 0) then Result := Result * 1000;
      end;
    end;

    http://www.villavu.com/repositories/...re/Amount.scar

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  5. #5
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I found another one:
    Code:
    [Runtime Error] : Exception: Access violation at address 0385D27B in module 'WizzyPlugin.dll'. Read of address 17FA8000 in line 507 in script D:\RSCHEAT\scar\SCAR 3.20\includes\SRL/SRL/Core/Text.scar
    i don't know what the script was doing when this occurred.

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    That sometimes happens, it's a problem with WizzyPlugin, I think the FindTPAinTPA.

    Just restart the script w/e

  7. #7
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    before you call whatever caused that do:

    SCAR Code:
    try
    //...
    except end;

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  8. #8
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    That last error you got sounds like you might have forgotten to set the nickname of a player.

  9. #9
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    That last error you got sounds like you might have forgotten to set the nickname of a player.
    hmm, maybe i have used an invalid nick.
    i do it automatically in my script, like
    players[i].nick := copy(mFighter[i].name, 2, 4);
    or something like that...

    weird that this was the 1st time that happened and ive been using it for like a month now

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
  •