Results 1 to 7 of 7

Thread: Bank.scar BankScreen;

  1. #1
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default Bank.scar BankScreen;

    The current one seems to have some unnecessary code, though I could just be misunderstanding it.
    Current function:
    SCAR Code:
    {*******************************************************************************
    function BankScreen: Boolean;
    by: SRL Dev Team
    Description: Finds Bankscreen. Returns true if Found.
    *******************************************************************************}


    function BankScreen: Boolean;
    var
      c: Integer;
    begin
      if (CountColor(0, MSX1, MSY1, MSX2, MSY2) > 113000) then
      begin
        MouseBox(26, 138, 489, 157, 1);
        c := GetTimeRunning + 45000;
        while (not BankScreen) and (GetTimeRunning < c) do
          Wait(50);
        Wait(RandomRange(100, 150));
      end;
      Result := FindTextTPA(4106994, 20, 20, 22, 400, 45, 'Bank', upchars, Nothing);
    end;

    My version:
    SCAR Code:
    function BankScreen: Boolean;
    var
      i: Integer;
    begin
      if not LoggedIn then Exit;
      for i := 0 to 1 do
      begin
        Result := CountColor(4106994, 194, 25, 322, 44) = 423;
        if Result then
          Exit
        else
          MouseBox(35, 67, 449, 271, 3);
      end;
    end;

    They both work at the same speed so it really doesn't matter, just posting for opinions..

  2. #2
    Join Date
    Oct 2009
    Location
    Melb, Australia
    Posts
    179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Why does your function need to loop twice?
    Also isn't it a bit unsafe to have it set for a fixed colour count?

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by code841 View Post
    Why does your function need to loop twice?
    Also isn't it a bit unsafe to have it set for a fixed colour count?
    It loops twice because it counts the color in the title and incase the mouse the over the name, then it moves the mouse and searches for the title again.

    And it's not unsafe to have a fixed color count because it doesn't change

    I have tested this many times and used in many of my scripts.

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    It loops twice because it counts the color in the title and incase the mouse the over the name, then it moves the mouse and searches for the title again.

    And it's not unsafe to have a fixed color count because it doesn't change

    I have tested this many times and used in many of my scripts.
    No need for the loop, as far as I know.. Have your mouse over the title, run it, and I'm sure it'll work without looping.

    If I recall correctly, SCAR doesn't take the mouse into effect for color searches?

  5. #5
    Join Date
    Oct 2009
    Location
    Melb, Australia
    Posts
    179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No it doesn't. Another thing to consider is the lag, the bank doesn't always open open up instantly for me. I think the wait times are good.

  6. #6
    Join Date
    Sep 2008
    Location
    Chicago
    Posts
    224
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    imo it should just be this (like it used to be)

    SCAR Code:
    function BankScreen: Boolean;
    begin
      Result := FindTextTPA(4106994, 20, 20, 22, 400, 45, 'Bank', upchars, Nothing);
    end;

    not sure what all that other code is for...

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    No need for the loop, as far as I know.. Have your mouse over the title, run it, and I'm sure it'll work without looping.

    If I recall correctly, SCAR doesn't take the mouse into effect for color searches?
    Doesn;t matter anyways as if it finds it on the first loop through it will exit the function anyways, so it doesn't waist any time.

    Quote Originally Posted by code841 View Post
    No it doesn't. Another thing to consider is the lag, the bank doesn't always open open up instantly for me. I think the wait times are good.
    IMO Lag should be compensated for in the script it self. Functions in SRL are meant to do sole purpose. It is the script writers responsibility to take Lag into factor when coding.

    Quote Originally Posted by Heysus View Post
    imo it should just be this (like it used to be)

    SCAR Code:
    function BankScreen: Boolean;
    begin
      Result := FindTextTPA(4106994, 20, 20, 22, 400, 45, 'Bank', upchars, Nothing);
    end;

    not sure what all that other code is for...
    I'm assuming the reason it isn't like that any more is because RS went through a bit of a phase where they changed there text's around a bit. By using color searches, that doesn't effect the functions.
    Last edited by NCDS; 02-11-2010 at 02:16 AM.

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
  •