Issue: GetCurrentBankTab

  1. issueid=470 03-20-2016 11:42 PM
    SRL Member
    GetCurrentBankTab
    Returns which tab is currently open in the bank.

    We have a GetCurrentTab for gametabs, so I decided to make a GetCurrentBankTab. It returns the number of the current bank tab that is open, 0 for "view all tab" and -1 if you are not logged in or the bank is not open.

    Code:
    function getCurrentBankTab: Integer;
    var
      TNB:TBox;
      TabNum,X,Y:Integer;
    begin
      Result := -1;
      if (not LoggedIn) or (not BankScreen) then exit;
      for TabNum := 0 to 9 do
      begin
        case TabNum of
        //tiny boxes top left of bank tabs
          0: TNB:= IntToBox(66,47,74,51);
          1: TNB:= IntToBox(105,44,111,49);
          2: TNB:= IntToBox(142,43,150,50);
          3: TNB:= IntToBox(182,42,191,51);
          4: TNB:= IntToBox(222,43,233,53);
          5: TNB:= IntToBox(263,44,273,53);
          6: TNB:= IntToBox(303,44,309,48);
          7: TNB:= IntToBox(343,43,353,51);
          8: TNB:= IntToBox(384,43,396,50);
          9: TNB:= IntToBox(422,43,429,50);
        end;
        if FindColorTolerance(X,Y,3292485,TNB.X1,TNB.Y1,TNB.X2,TNB.Y2,13) then  //UPDATED COLOR
          break;
      end;
      result:= tabNum;
    end;
    EDIT: This was made for OSRS.

    EDIT2:

    I also made BankTabExists.. Depending on the placement of the parenthesis, I can get it to say false for tabs that don't exist, or true for tabs that do exist, but for some reason, I can't get it to not get false positives every time.
    Ex:
    - Tab 1 doesn't exist and it returns true, but false for tabs 2-9.
    - Tab 1 does exist, but returns false for tabs 1-9.

    If anyone wants to mess with this till it works that'd be cool. I don't really need this, just figured I'd add it. The GetColor coords and colors I chose should be correct. I was using OSRS fixed client size, max brightness.

    Code:
    function BankTabExists(tab: integer): Boolean;
    var
      tmpCTS,X,Y: integer;
    begin
      result := false;
      if (not loggedIn) then
        exit;
      if(tab = 0)then
      begin
        result:= true;
        exit;
      end;
      if (not inRange(tab, 1, 9)) then
      begin
        SRL_Warn('BankTabExists', 'Tab ' + toStr(Tab) + ' is not a valid tab number.', warn_AllVersions);
        exit;
      end;
    
      // requires CTS 1, may result in false negatives if CTS 2
      tmpCTS := getColorToleranceSpeed;
      colorToleranceSpeed(1);
    
      case tab of
        1: result:= ((GetColor(105, 46) = 2700090) or (GetColor(105, 46) = 3358280)) and (not getColor(120, 64)= 5135982);
        2: result:= (GetColor(147, 47) = 2700090 or GetColor(147, 47) = 3358280) and (not getColor(160, 64)= 5135982);
        3: result:= (GetColor(185, 46) = 2700090 or GetColor(185, 46) = 3358280) and (not getColor(200, 64)= 5135982);
        4: result:= (GetColor(228, 46) = 2700090 or GetColor(228, 46) = 3358280) and (not getColor(240, 64)= 5135982);
        5: result:= (GetColor(267, 47) = 2700090 or GetColor(267, 47) = 3358280) and (not getColor(280, 64)= 5135982);
        6: result:= (GetColor(306, 46) = 2700090 or GetColor(306, 46) = 3358280) and (not getColor(320, 64)= 5135982);
        7: result:= (GetColor(347, 48) = 2700090 or GetColor(347, 48) = 3358280) and (not getColor(360, 64)= 5135982);
        8: result:= (GetColor(388, 45) = 2700090 or GetColor(388, 45) = 3358280) and (not getColor(400, 64)= 5135982);
        9: result:= (GetColor(423, 47) = 2700090 or GetColor(423, 47) = 3358280) and (not getColor(440, 64)= 5135982);
      end;
      colorToleranceSpeed(tmpCTS);
    end;
    Also, if a mod could move this to OSR-SRL development, it'd be appreciated as that would be a better place for this thread. Even though the include is dead, I've been slowly updating mine as I need it.
Issue Details
Issue Number 470
Issue Type Feature
Project SRL Bugs and Suggestions
Status Suggested
Votes for this feature 1
Votes against this feature 0
Assigned Users (none)
Tags (none)




+ Reply