Results 1 to 15 of 15

Thread: LoggedIn ~ change

  1. #1
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default LoggedIn ~ change

    Here is what I think would work a tad bit better

    Simba Code:
    (*
    LoggedIn
    ~~~~~~~~

    .. code-block:: pascal

        function LoggedIn: Boolean;

    Returns True if Logged in.

    .. note::

        by WT-Fakawi, Getdropped

    Example:

    .. code-block:: pascal

    *)

    function LoggedIn: Boolean;
    begin
      //White text on Report Abuse Button
      if (GetColor(472, 490) = 16777215) then
      begin
        Result := true;
        Exit;//no need to do anything to the navbar
      end;
      SRL_ResetNavBar;
      Result := (GetColor(472, 490) = 16777215);
    end;

    It was :
    Simba Code:
    (*
    LoggedIn
    ~~~~~~~~

    .. code-block:: pascal

        function LoggedIn: Boolean;

    Returns True if Logged in.

    .. note::

        by WT-Fakawi

    Example:

    .. code-block:: pascal

    *)

    function LoggedIn: Boolean;
    begin
      //White text on Report Abuse Button
      SRL_ResetNavBar;
      Result := (GetColor(472, 490) = 16777215);
    end;

    It would be more efficient to not check for the nav bar if you already found the report button wouldn't it? just a thought

    PS. Not sure if this is the right place but throught it looked right
    Reason I made the change is because it was being buggy when banking see : http://villavu.com/forum/showthread.php?t=91755

    ~Getdropped

  2. #2
    Join Date
    Jan 2012
    Location
    127.0.0.1
    Posts
    702
    Mentioned
    11 Post(s)
    Quoted
    76 Post(s)

    Default

    good job, now let the major testing begin

  3. #3
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Yeah i guess that would be slightly more efficient, good work.

    Though it might be better to use a loop instead of repeating GetColor:
    Simba Code:
    function LoggedIn: Boolean;
    var
      i: Integer;
    begin
      for i:=1 to 2 do
      begin
        //White text on Report Abuse Button
        if (GetColor(472, 490) = 16777215) then
        begin
          Result := true;
          Exit;//no need to do anything to the navbar
        end;

        if (i = 1) then
          SRL_ResetNavBar;
      end;
    end;

  4. #4
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Yeah i guess that would be slightly more efficient, good work.

    Though it might be better to use a loop instead of repeating GetColor:
    Simba Code:
    function LoggedIn: Boolean;
    var
      i: Integer;
    begin
      for i:=1 to 2 do
      begin
        //White text on Report Abuse Button
        if (GetColor(472, 490) = 16777215) then
        begin
          Result := true;
          Exit;//no need to do anything to the navbar
        end;

        if (i = 1) then
          SRL_ResetNavBar;
      end;
    end;
    no because it still needs to search the same point for the colors to see if you were logged in and it found that the navbar needed to be reset... else that would work, it is like an extra check plus in theory you wouldnt even need a counter just an else wasted var

    ~Getdropped

  5. #5
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Getdropped View Post
    no because it still needs to search the same point for the colors to see if you were logged in and it found that the navbar needed to be reset... else that would work, it is like an extra check plus in theory you wouldnt even need a counter just an else wasted var

    ~Getdropped
    Not sure what you mean but my code should do exactly as yours, just that some people may find it slightly untidy to repeat 2 identical GetColor check within a function. Not a big deal though.

  6. #6
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Why not just?
    Simba Code:
    function LoggedIn: Boolean;
    begin
      //White text on Report Abuse Button
      Result := GetColor(472, 490) = 16777215;
      if Result then
        Exit else
      begin
        SRL_ResetNavBar;
        Result := (GetColor(472, 490) = 16777215);
      end;
    end;

  7. #7
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Not sure what you mean but my code should do exactly as yours, just that some people may find it slightly untidy to repeat 2 identical GetColor check within a function. Not a big deal though.
    oh i see what you are saying, What i was trying to say it that it would just be safer to have it recheck the point after it resets the nav bar

    Edit:
    Quote Originally Posted by P1ng View Post
    Why not just?
    Simba Code:
    function LoggedIn: Boolean;
    begin
      //White text on Report Abuse Button
      Result := GetColor(472, 490) = 16777215;
      if Result then
        Exit else
      begin
        SRL_ResetNavBar;
        Result := (GetColor(472, 490) = 16777215);
      end;
    end;
    There are a lot of ways i guess you could write it lol

  8. #8
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    I just figured there is no point performing the extra check if it's already found that you are logged in. But other than that it doesn't do anything differently.

  9. #9
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by P1ng View Post
    I just figured there is no point performing the extra check if it's already found that you are logged in. But other than that it doesn't do anything differently.
    NO look again it only checks again if it doesnt find it lol I even wrote it in the function -.-
    I checks before it resets the nav bar and if not found it checks again and returns the varient....

  10. #10
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  11. #11
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by Getdropped View Post
    NO look again it only checks again if it doesnt find it lol I even wrote it in the function -.-
    I checks before it resets the nav bar and if not found it checks again and returns the varient....
    My apologies, hungover and skimming past things like exits :P Either way, I also support this change to the include

  12. #12
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Getdropped View Post
    oh i see what you are saying, What i was trying to say it that it would just be safer to have it recheck the point after it resets the nav bar
    Yeah it does recheck, that's what the loop is for.
    Also i'm assuming it's just done for slight efficiency and FoundBar is not broken?

    Quote Originally Posted by P1ng View Post
    I just figured there is no point performing the extra check if it's already found that you are logged in. But other than that it doesn't do anything differently.
    Yeah it's exiting if found so i guess makes not much difference to add an else.
    Although i've been pondering over this:
    Simba Code:
    if Condition then
    begin
      Result:= True;
      Actions;
    end;


    Result:= Condition;
    if Result then
      Actions;
    which of them is more efficient? The difference is probably negligible but i'm interested to know which is more 'standard'?

  13. #13
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    I personally prefer the latter, but I am not aware as to whether or not it makes a difference. Just how I prefer to read the code.

  14. #14
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by P1ng View Post
    Why not just?
    Simba Code:
    function LoggedIn: Boolean;
    begin
      //White text on Report Abuse Button
      Result := GetColor(472, 490) = 16777215;
      if Result then
        Exit else
      begin
        SRL_ResetNavBar;
        Result := (GetColor(472, 490) = 16777215);
      end;
    end;
    Send a pull req for this pl0x.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  15. #15
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by litoris View Post
    Send a pull req for this pl0x.
    How do you send pull reqs?

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
  •