Results 1 to 6 of 6

Thread: that feel when you spend 2hours on 2 lines.

  1. #1
    Join Date
    Dec 2014
    Posts
    383
    Mentioned
    2 Post(s)
    Quoted
    206 Post(s)

    Default that feel when you spend 2hours on 2 lines.

    been working on a work-around for when an account gets banned -> transition to next player ( ATM doesn't seem to detect any of the pop-up messages )


    2 fricking hours. before i've finally found a solution... well a little more than 2 lines.


    This was the last thing i've tried, been trying to deal with this outside of overrides hence why it took so long lol

    Before:
    Simba Code:
    function TPlayer.loginToLobby(): boolean;
    var
      tries: integer = 1;
      reachedMaxTries: boolean;
    begin
      print('TPlayer.loginToLobby(): ', TDebug.HEADER);
      __areDynamicInterfacesSet := false;

      if (not self.isActive) then
      begin
        print('TPlayer.loginToLobby(): Player ' + self.nickname + ' is not active...', TDebug.FOOTER);
        exit(false);
      end;

      if lobby.isOpen() then
      begin
        print('TPlayer.loginToLobby(): Player ' + self.nickname + ' is already in lobby.', TDebug.FOOTER);
        exit(true);
      end;

      if (not __setInputBoxes()) then
      begin
        print('TPlayer.loginToLobby(): Failed to find username and/or password box', TDebug.FOOTER);
        exit(false);
      end;

      repeat
        if (isLoggedIn() or lobby.isOpen()) then
        begin
          result := true;
          break;
        end;

        print('Login Attempt ' + toStr(tries) + ': ' + capitalize(self.loginName) + ' (' + capitalize(self.displayName) + ')');

        print('Entering username...', TDebug.SUB);
        __enterLoginInfo(__boxUsername, self.loginName, true, true);
        wait(500 + random(200));

        print('Entering password...', TDebug.SUB);
        __enterLoginInfo(__boxPassword, self.password, false, true);
        wait(800 + random(200));

        result := self.__handleLoginPopup(inc(tries), false, reachedMaxTries);

        if reachedMaxTries then tries := 1; //'reachedMaxTries' is passed down from __respondToPopup()
      until result;

      if (not disableIPScreenshots) then takeScreenshot('IP_address.png');

      print('TPlayer.loginToLobby(): ' + toStr(result), TDebug.FOOTER);
    end;

    FIX:

    Simba Code:
    function TPlayer.loginToLobby(): boolean;
    var
    timer:TTimeMarker;
    begin
      print('TPlayer.loginToLobby(): ', TDebug.HEADER);
      __areDynamicInterfacesSet := false;

      if (not self.isActive) then
      begin
        print('TPlayer.loginToLobby(): Player ' + self.nickname + ' is not active...', TDebug.FOOTER);
        exit(false);
      end;

      if lobby.isOpen() then
      begin
        print('TPlayer.loginToLobby(): Player ' + self.nickname + ' is already in lobby.', TDebug.FOOTER);
        exit(true);
      end;

      if (not __setInputBoxes()) then
      begin
        print('TPlayer.loginToLobby(): Failed to find username and/or password box', TDebug.FOOTER);
        exit(false);
      end;
      timer.reset;
      timer.start;
      repeat
        if (isLoggedIn() or lobby.isOpen()) then
        begin
          result := true;
          break;
        end;

        print('Login Attempt ' + toStr(tries) + ': ' + capitalize(self.loginName) + ' (' + capitalize(self.displayName) + ')');

        print('Entering username...', TDebug.SUB);
        __enterLoginInfo(__boxUsername, self.loginName, true, true);
        wait(500 + random(200));

        print('Entering password...', TDebug.SUB);
        __enterLoginInfo(__boxPassword, self.password, false, true);
        wait(800 + random(200));
      until Lobby.isOpen or (timer.getTime() > 30000);
      if (timer.getTime() > 30000) then
        begin
          typeByte(VK_ESCAPE);
          Players.next();
        end;
    end;

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    fwiw you probably don't need to reset() and then start() your TTimeMarker, you can just start() it and not worry about resetting

    reason being is that it will be completely re-initalized every time the function is called since it's a local variable

    so really you spent 2 hours on 1 line
    Last edited by KeepBotting; 03-18-2016 at 08:18 PM.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Dec 2014
    Posts
    383
    Mentioned
    2 Post(s)
    Quoted
    206 Post(s)

    Default

    i've had issues with TTimeMarkers and Tboxes, so I will always call reset before start, and always call var TBox's for each function instead of global can't stop me im such a rebel!

  4. #4
    Join Date
    Mar 2015
    Posts
    189
    Mentioned
    3 Post(s)
    Quoted
    73 Post(s)

    Default

    Rip

  5. #5
    Join Date
    Jul 2015
    Posts
    80
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    I have it often, but you got it done eventually.

  6. #6
    Join Date
    Oct 2016
    Posts
    12
    Mentioned
    1 Post(s)
    Quoted
    6 Post(s)

    Default

    I've had the same thing happen to me. One hour or so stuck on an error that was redirecting to multiple places in my code, because of one letter that was missing in my include statement.

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
  •