Results 1 to 5 of 5

Thread: How to Add Auto-Login to A Script?

  1. #1
    Join Date
    Mar 2013
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default How to Add Auto-Login to A Script?

    I'm wondering if there is a way to add an auto-login function to a script in case the server dc's so you do not have to check up on the script as often. If anyone has a snippet, that would be helpful, or if someone could walk me through how to write the code, that would be awesome. Thanks.

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    This is what I used in one of my scripts:
    Simba Code:
    1. function isLoggedIn(): boolean;
    2. var
    3.   x, y: integer;
    4. begin
    5.   result := findColor(x, y, 65536, 740, 0, 760, 25);
    6. end;
    You can then do something like
    Simba Code:
    while isLoggedIn do mainloop();
    as long as your other procedures can't get stuck infinitely.

    As for logging in, you can get away with just basic clicking and typing.
    Last edited by Citrus; 05-31-2016 at 07:11 PM.

  3. #3
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    The SRL Include is always going to be a great resource when considering how to tackle issues on private servers.

    https://github.com/SRL/SRL/blob/8291...lient.simba#L1

    The general idea for getting the login state is to identify a color that is either unique to the login or game screen. Once you have that it's just a simple Find/GetColor as shown in the link above and also by Citrus.

    For logging in, http://docs.villavu.com/simba/script...dkeyboard.html should give you some help when it comes to keyboard input.
    Simba Code:
    SendKeys('username', 100, 30); // types out the username
    PressKey(13); // hits enter
    SendKeys('password', 100, 30); // types out the password
    PressKey(13); // hits enter
    You will of course want to add checks that the login screen is open, which textbox is currently selected etc.

  4. #4
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Simba Code:
    function IsLoggedIn(): boolean;
    begin
      result := (getColor(401, 436) = 4231423);  //some color on the logout screen, pick a color from an area that is static when logged in
    end;

    begin
      if (not isLoggedIn()) then
        SomeLoginProcedure();
    end.

  5. #5
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Following up on jstemper's response if you are using SRL-6 you are going to want to ovvride the isLoggedIn function

    Simba Code:
    function IsLoggedIn(): boolean; override;
    begin
      result := (getColor(401, 436) = 4231423);  //some color on the logout screen, pick a color from an area that is static when logged in
    end;

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
  •