Results 1 to 16 of 16

Thread: GameTab

  1. #1
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default GameTab

    I was looking through the GameTab function today and thought I would bring something to attention.

    The way it is now:

    SCAR Code:
    Tries := 0;
        while (Tries < 3) do
        begin
          Mouse(tP.X, tP.Y, 0, 0, True);

          T := GetSystemTime;
          while (not Result) and (GetSystemTime - T < 2000) do
          begin
            Result := (GetCurrentTab = Tab);
            Wait(100 + Random(100));
          end;

          Inc(Tries);
        end;

    Now the way I understand this (maybe I am wrong) but when it enters the 2nd while loop, if it ends up with a 'Result := True' it will then exit that loop, it will then inc(tries) go back up to Mouse again and repeat Mouse more times.

    So shouldn't there be a 'If Result Then Exit' somewhere in this loop so we don't repeatedly Mouse to the GameTab?

    Like I said, maybe I am wrong or missing something but that is how I understand it.
    Last edited by Wanted; 04-29-2010 at 11:32 PM.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  2. #2
    Join Date
    Mar 2007
    Posts
    478
    Mentioned
    4 Post(s)
    Quoted
    4 Post(s)

    Default

    I think you are right. The 'If Result Then Exit' should go right before 'Inc(Tries)'.
    Back from the dead.....

  3. #3
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    SCAR Code:
    {*******************************************************************************
    function GameTab(Tab: integer): boolean;
    By: ZephyrsFury
    Description: Switches to a specific game tab.
    const
      tab_Combat = 21;
      tab_Stats = 22;
      tab_Quest = 23;
      tab_Diary = 24;
      tab_Inv = 25;
      tab_Equip = 26;
      tab_Prayer = 27;
      tab_Magic = 28;
      tab_Objectives = 29;
      tab_Friends = 30;
      tab_Ignore = 31;
      tab_Clan = 32;
      tab_Options = 33;
      tab_Emotes = 34;
      tab_Music = 35;
      tab_Notes = 36;
      tab_LogOut = 37;
    *******************************************************************************}

    function GameTab(Tab: integer): boolean;
    var
      tP: TPoint;
      T, Tries: integer;
    begin
      if (Tab < 20) then
      begin
        SRL_Warn('GameTab', 'Tab ' + IntToStr(Tab) + ' is not using the new constants! Please update your script.', warn_AllVersions);
        Exit;
      end;

      if (not (InRange(Tab, Tab_Combat, Tab_LogOut))) then
      begin
        SRL_Warn('GameTab', 'Tab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_AllVersions);
        Exit;
      end;

      Result := (GetCurrentTab = Tab);
      if (Result) then
        Exit;

      if (TabExists(Tab)) then
      begin
        tP := Point((Tab - 21) mod 8 * 30 + RandomRange(527, 545), (Tab - 21) div 8 * 298 + RandomRange(177, 197));
        if (Tab = tab_LogOut) then
          tP := Point(RandomRange(747, 760), RandomRange(3, 18));

        Tries := 0;
        while (not Result) and (Tries < 3) do
        begin
          Mouse(tP.X, tP.Y, 0, 0, True);

          T := GetSystemTime;

          while (not Result) and (GetSystemTime - T < 2000) do
          begin
            Result := (GetCurrentTab = Tab);
            Wait(100 + Random(100));
          end;

          Inc(Tries);
        end;

      end else
        SRL_Warn('GameTab', 'GameTab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_Notice);
    end;
    Last edited by Dgby714; 04-29-2010 at 05:42 PM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  4. #4
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Can't you just do while (tries <3) and (not Result) do?

  5. #5
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Can't you just do while (tries <3) and (not Result) do?
    Yes, whatever works.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  6. #6
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Can't you just do while (tries <3) and (not Result) do?
    disregard...
    Last edited by Dgby714; 04-29-2010 at 05:43 PM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Dgby714 View Post
    s/and/or/
    If you use or it will continue if one of them is true, with and it will break if one of them is true, which is what you want.

  8. #8
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    If you use or it will continue if one of them is true, with and it will break if one of them is true, which is what you want.
    wow i feel stupid now... lol

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  9. #9
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good catch, I'm sure whoever did this did it by accident and it went undetected for a long time because it caused no major problems

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

    Default

    I always noticed this, but never realized that it was SRL. I thought that somehow I was clicking without clicking.

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

    Default

    Quote Originally Posted by icefire908 View Post
    good catch, i'm sure whoever did this did it by accident and it went undetected for a long time because it caused no major problems

    no! Mischief!

    sabotage!

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Dgby714 View Post
    wow i feel stupid now... lol
    It happens to everyone.

  13. #13
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Good catch, I'm sure whoever did this did it by accident and it went undetected for a long time because it caused no major problems
    T'was me Sowwy!

  14. #14
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by ZephyrsFury View Post
    T'was me Sowwy!

  15. #15
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    That photo looks like the cropped it with real scissors and a 4 year old

  16. #16
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    That photo looks like the cropped it with real scissors and a 4 year old
    Lol that's google.

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
  •