Results 1 to 3 of 3

Thread: Few things

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

    Default Few things

    chooseoption is failing again
    bankscreen is failing
    amount.scar could use an update

    gaaaahhh >.>

    ~RM

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

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

    Default

    BankScreen is working 100% for me

  3. #3
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Here you go RM, I made a few modifications to the functions in amount.scar:

    SCAR Code:
    // This one was unable to read 3+ digit numbers, fixed it.
    // Also added Result to return -1, when FindColorsTolerance returns false.
    function GetAmount(ItemX, ItemY: Integer): Integer;
    var
      S: string;
      Col, II: Integer;
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      Result := Integer(FindColorsTolerance(TPA, 65536, ItemX - 50, ItemY - 50, ItemX + 50, ItemY + 50, 0)) * -1;
      if (Result = -1) then
      begin
        SortTPAFrom(TPA, Point(ItemX, ItemY));
        ATPA := SplitTPAEx(TPA, 5, 5);
        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;
        SortTPAFrom(TPA, Point((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1));
        ATPA := SplitTPAEx(TPA, 5, 5);
        TPA := ATPA[0];
        Col := 7575987 * II * II - 6796134 * II + 65535;
        B := GetTPABounds(TPA);
        S := Trim(GetTextAtEx(B.X1 - 5, B.Y1 - 1, 0, StatChars, False, False, 0, 1, Col, 4, 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;

    SCAR Code:
    // I made this into a function.
    // Returns false if @param Name, equals the active tab
    function ShopSwitchTab(Name: string): Boolean;
    begin
      if not InStrArr(Name, ['main', 'player'], False) then
      begin
        srl_Warn('ShopSwitchTab', 'Name: ' + Name + ' is not a valid tab.', warn_AllVersions);
        Exit;
      end;
      if (ShopScreen) then
        Result := FindTextTpa(1930687, 0, 50, 65, 225, 83, Capitalize(Name), SmallChars, ClickLeft);
    end;



    ~NS

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
  •