Results 1 to 6 of 6

Thread: Can't Log In(Numerous scripts)

  1. #1
    Join Date
    Nov 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Can't Log In(Numerous scripts)

    The Script will Work fine.
    But When it is Supposed to log in The Mouse Just Hovers of "Please log In".

    (The Log In Screen after You Click Log In)

    Please help As I Have 89 Wc and Need 99 :P

    I Am using Camo's Wcer Atm.
    And Other Numerous Scripts Would not work for me because of that.

  2. #2
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Search for 'LoginPlayer' or something;
    There's been made a fix already ill post it asap

    EDIT;
    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป Login Routines                              --//
    //-----------------------------------------------------------------//
    // * function  RSReady: Boolean;                      // * by ZephyrsFury
    // * Procedure LoginScreenMusic(State: Variant);      // * by Wizzup?
    // * procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );  // * by ZephyrsFury
    // * procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fl, gt, cs: string);    // * by ZephyrsFury
    // * procedure SetAutoingDefaults;                    // * by ZephyrsFury
    // * procedure Logout;                                // * by Starblaster100 and Raymond
    // * procedure LoginPlayer;                           // * by SRL Developers
    // * procedure RandomNextPlayer(Active: Boolean);     // * by Dankness, Ron and Raymond
    // * procedure NextPlayer(Active: Boolean);           // * by Dankness, Ron and Raymond
    // * procedure CheckUserNicks;                        // * by Sumilion and Raymond

    { var SRL_Logs: Integer;
      Description: Variables needed for some login functions. }

    { var RandomPlayer, GraphicsSet: Boolean;
      Description: Variables needed for some login functions. }

    var
      SRL_Logs: Integer;
      RandomPlayer, GraphicsSet: Boolean;

    procedure NextPlayer(Active: Boolean); forward;
    procedure RandomNextPlayer(Active: Boolean); forward;

    {*******************************************************************************
    function RSReady: Boolean;
    By: ZephyrsFury
    Description: Returns true if we are ready to auto (on loginscreen or logged in).
      Useful for waiting until RS has fully loaded.
    *******************************************************************************}


    function RSReady: Boolean;
    begin
      Result := (LoggedIn) or (GetColor(520, 146) = 4038981);
    end;

    {*******************************************************************************
    Procedure LoginScreenMusic(State: Variant);
    By: Wizzup?
    Description: Takes Boolean(True, False) or Integer(1..5) as arguments.
      1 or True = Off, 5 or False = Max.
          1   2   3   4   5
        <-o---o---o---o---o->
    *******************************************************************************}


    Procedure LoginScreenMusic(State: Variant);

    Var
       RealState: Variant;
       x: Extended;

    Begin
      if (LoggedIn) then Exit;
      if (CountColor(7750, 346, 356, 416, 369) <> 119) and (GetColor(520, 135) = 4038981) then
      begin
        TypeByte(vk_Escape);
        Wait(100);
      end;
      if (CountColor(7750, 346, 356, 416, 369) <> 119) then Exit;
      Case VarType(State) Of
      11: RealState := (State + 1) * 4;
      3: If InRange(State, 1, 5) Then
           RealState := State - 1;
         Else
           RealState := 0;
      End;
      x := (425.0 - 337.0) * RealState / 4.0 + 339.0;
      If CountColorTolerance(1647966, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
        If CountColorTolerance(991349, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
          Mouse(Round(x), RandomRange(375, 385), 0, 0, True);

    End;

    {*******************************************************************************
    procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );
    By: ZephyrsFury
    Description: Sets audio options through the login screen.
    Use: Enter the desired Setting for the desired Option. Make option 0 for no change.
      EG. Login_SetAudio(1, 5, 2, NoChange);

                            1   2   3   4   5
      Volume, SFX, Area:  <-o---o---o---o---o->
    *******************************************************************************}


    procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: TSMSetting);
    var
      II, Tx, Ty, T: Integer;
      Pts: TIntegerArray;
    begin
      if (LoggedIn) then Exit;
      TypeByte(vk_Escape);
      T := GetSystemTime;
      while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
        Wait(100);
      if (CountColor(7750, 346, 373, 416, 386) = 119) then
        MouseBox(334, 362, 426, 371, 1)
      else
        Exit;
      Wait(100);
      Pts := [Volume, SFX, Area];
      for II := 0 to 2 do
      begin
        if (Pts[II] = 0) then Continue;
        if (not(InRange(Pts[II], 0, 5))) then
        begin
          srl_Warn('Login_SetAudio', 'Points must be between 0 and 5', warn_AllVersions);
          Continue;
        end;
        Tx := 337 + Round((425 - 337) * (Pts[II] - 1) / 4);
        Ty := Round(3.5 * II * II + 46.5 * II + 245);
        if (GetColor(Tx, Ty) <> 1121100) then
          Mouse(Tx + 2, Ty - 14, 0, 0, True);
        Wait(50);
      end;
      if (GetColor(337, 389) = 181) and (SMSetting = Stereo) then
        Mouse(421, 385, 10, 10, True)
      else
      if (GetColor(426, 389) = 181) and (SMSetting = Mono) then
        Mouse(332, 385, 10, 10, True);
      Wait(100);
      TypeByte(vk_Escape);
    end;

    {*******************************************************************************
    procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
    By: ZephyrsFury
    Description: Sets graphic options in the login screen.
    Use: Enter the desired Setting for the desired Option.
      Leave as 0 for no change of brightness and '' for no change in anything else.

      Parameter    Option                Setting
        Brightness   Brightness            1 - 4 (0 for no change)
        vl           Visible Levels        Current / All
        rr           Remove Roofs          Always / Selectively
        gd           Ground Decoration     Off / On
        td           Texture Detail        Low / High
        ia           Idle Animations       Few / Many
        fe           Flickering Effects    Off / On
        gt           Ground Textures       Few / Many
        cs           Chracter Shadows      Off / On

                        1   2   3   4
      Brightness:   <---o---o---o---o--->

    EG. Login_SetGraphics(2, 'current', '', 'off', 'low', 'few', '', 'few', 'off');

    For Autoing:
    Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
    *******************************************************************************}


    procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
    var
      Settings, PosSettings, OptionName: TStringArray;
      II, T, W, tCol, x, y, mSpeed: Integer;
      TB: TBox;
      P: TPoint;
    begin
      if (LoggedIn) then Exit;
      Settings := [vl, rr, gd, td, ia, fe, gt, cs];
      PosSettings := ['Current', 'All', 'Always', 'Selectively', 'Off', 'On', 'Low',
        'High', 'Few', 'Many', 'Off', 'On', 'Few', 'Many', 'Off', 'On'];
      OptionName := ['Visible levels', 'Remove roofs', 'Ground decoration', 'Texture detail',
        'Idle animations', 'Flickering effects', 'Ground textures', 'Character shadows'];
      TypeByte(vk_Escape);
      T := GetSystemTime;
      while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
        Wait(100);
      if (CountColor(7750, 346, 373, 416, 386) = 119) then
        MouseBox(321, 338, 443, 346, 1)
      else
        Exit;
      mSpeed := MouseSpeed;
      MouseSpeed := 25;
      Wait(100);
      if (Brightness > 4) then
        srl_Warn('Login_SetGraphics', 'Brightness must be between 0 and 4', warn_AllVersions)
      else
      if (Brightness <> 0) then
      begin
        P := Point(89 + (Brightness - 1) * 21, 266);
        if (GetColor(P.x, P.y) <> 1121100) then
          Mouse(P.x - 3, P.y - 17, 6, 6, True);
      end;
      for II := 0 to 7 do
      begin
        TB.x1 := 67 + 130 * ((II + 1) mod 5);
        TB.y1 := 245 + 60 * ((II + 1) div 5);
        TB.x2 := TB.x1 + 109;
        TB.y2 := TB.y1 + 15;
        if (not(InStrArrEx(Capitalize(Settings[II]), [PosSettings[II * 2], PosSettings[II * 2 + 1]], W))) then
        begin
          srl_Warn('Login_SetGraphics', 'Invalid Setting: ' + Settings[II] + ' for Option: ' + OptionName[II] + '.', warn_AllVersions);
          Continue;
        end;
        tCol := (W mod 2) * 16777088 + 127;
        if (not(FindColor(x, y, tCol, TB.x1, TB.y1, TB.x2, TB.y2))) then
        begin
          Mouse(TB.x1 + 10, TB.y1 + 3, 10, 7, True);
          if (FindColor(x, y, tCol, TB.x1, TB.y2 + 1, TB.x2, TB.y2 + 1 + 51)) then
            Mouse(x, y, 10, 7, True)
          else
            MouseBox(TB.x1 + 10, TB.y1 + 3, TB.x2 - 40, TB.y2 - 3, 1);
        end;
      end;
      Wait(100);
      TypeByte(vk_Escape);
      MouseSpeed := mSpeed;
    end;

    {*******************************************************************************
    procedure SetAudioOff;
    By: ZephyrsFury
    Description: Sets the Audio to off (1 for each bar). Works logged in and out.
    *******************************************************************************}


    procedure SetAudioOff;
    begin
      if (LoggedIn) then
        SetAudio(1, 1, 1, NoChange)
      else
        Login_SetAudio(1, 1, 1, NoChange);
    end;

    {*******************************************************************************
    procedure SetAutoingDefaults;
    By: ZephyrsFury
    Description: Sets the graphic options for best SRL compatibility. Works both logged in and out.
    *******************************************************************************}


    procedure SetAutoingDefaults;
    begin
      if (LoggedIn) then
        SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off')
      else
        Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
    end;

    {*******************************************************************************
    procedure Logout;
    By: Starblaster100 / Raymond
    Description: Logs you out.
    *******************************************************************************}


    function Logout: Boolean;
    var
      c, i: Integer;
    begin
      Result := (not (LoggedIn));
      if Result = True then
        Exit;
      if GameTab(14) = False then
        Exit;
      Wait(200 + Random(100));
      while (LoggedIn) and (c < 10) do
      begin
        Inc(c);
        if(ClickText('here', UpChars, MIX1, MIY1, MIX2, MIY2, True))then
          for i := 0 to 10 do
          begin
            Wait(1000);
            if not(LoggedIn)then
            begin
              Result := True;
              Exit;
            end;
          end;
      end;
    end;

    {*******************************************************************************
    procedure LoginPlayer;
    By: SRL Developers
    Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
    *******************************************************************************}


    procedure LoginPlayer;
    var
      Mark, Attempts: Integer;
      Actions: TVariantArray;
      RetryLogin: Boolean;
    label
      ProcStart;
    begin
      ActivateClient;
      Wait(100);

      if (GetColor(212, 327) = 238301) then    //At Click To Play screen
      begin
        Wait(1000 + Random(3000));
        MouseBox(227, 337, 555, 364, 1);
        MarkTime(Mark);
        while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
          Wait(1000 + Random(1000));
      end;
      if (not(RSReady)) then
      begin
        MarkTime(Mark);
        while (not(RSReady)) do
        begin
          Wait(100);
          if (TimeFromMark(Mark) > 180000) then
          begin
            WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
            TerminateScript;
          end;
        end;
        WriteLn('Welcome to Runescape.');
      end;

      LoginScreenMusic(True);
      if (not(GraphicsSet)) then
      begin
        SetAutoingDefaults;
        GraphicsSet := True;
      end;
      ProcStart:

      if (not(LoggedIn)) then
      begin
        if (not(Players[CurrentPlayer].Active)) then
        begin
          WriteLn('Player is not Active...');
          NextPlayer(False);
          Exit;
        end;
        Wait(900 + random(60));

        //Click 'Log In' on main menu
        while (GetColor(343, 175) <> 7750) do
        begin
          MouseBox(360, 180, 400, 185, 1);
          Wait(100 + Random(100));
        end;

        //Type Username
        Mouse(315, 272, 10, 5, True);
        while (CountColor(7750, 311, 269, 452, 284) > 13) do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        for Mark := 0 to 3 do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        Wait(100 + Random(200));
        WriteLn(Capitalize(Players[CurrentPlayer].Name));
        TypeSend(Players[CurrentPlayer].Name);
        Wait(100+random(50));

        //Type Password
        Mouse(315, 334, 10, 5, True);
        while (CountColor(7750, 311, 337, 452, 352) > 13) do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        for Mark := 0 to 3 do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        Wait(100 + Random(200));
        TypeSend(Players[CurrentPlayer].Pass);
        Wait(500 + Random(300));

        if (not(FindTextTPA(12509695, 0, 288, 205, 475, 247, 'login', StatChars, Nothing))) then   //If 'enter' from typesend didn't log us in
        begin
          MouseBox(355, 359, 403, 372, 1);  //Click 'login' login screen
          Wait(250 + random(100));
        end;

        MarkTime(Mark);
        repeat
          SetLength(Actions, 0);

          if (TimeFromMark(Mark) > 60000) then
            Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
          else
          case (CountColor(12509695, 288, 205, 475, 247)) of   //Number of text colour points
            //   Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
            760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
            536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
            711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
            598: Actions := ['Invalid Username \ Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
            917: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
            408: Actions := ['World is full.', 5000, 20, 'Terminate', ''];
            623: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
            555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
            218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
            335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
            512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
            489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
            737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
            //10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
            //11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected'];  // Login server rejected session.
          end;

          if (Length(Actions) > 0) then
          begin
            WriteLn(Actions[0]);
            Wait(Actions[1] + Random(100));
            if (Actions[2] <> 0) then
              if (Attempts < Actions[2]) or (Actions[2] = -1) then
              begin
                RetryLogin := True;
                Break;
              end;
            if (Actions[4] <> '') then
              Players[CurrentPlayer].Loc := Actions[4];
            case Actions[3] of
              'NextPlayer': NextPlayer(False);
              'RandomNextPlayer': RandomNextPlayer(True);
              'Terminate': TerminateScript;
            end;
            Exit;
          end;
          Wait(100);
        until(GetColor(212, 327) = 238301);

        if (RetryLogin) then
        begin
          RetryLogin := False;
          Inc(Attempts);
          goto ProcStart;
        end;

        if (GetColor(212, 327) = 238301) then
        begin
          Wait(1000 + Random(2000));
          MouseBox(227, 337, 555, 364, 1);
        end;
        MarkTime(Mark);
        while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
          Wait(1000 + Random(1000));
      end;

      if (LoggedIn) then
      begin
        PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
        if Length(Players[CurrentPlayer].NickTPA) < 2 then
        begin;
          Writeln('Creating the NickTPA.');
          if Players[CurrentPlayer].Nick <> '' then
            Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
          else
          begin;
            Writeln('Nickname isn''t set, taking the username instead..');
            Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
          end;
        end;
        AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
      end;
    end;

    {*******************************************************************************
    procedure RandomNextPlayer(Active: Boolean);
    By: Dankness based on WT-Fawki's NextPlayer and modified by Ron and by Raymond
    Description: Picks Random Player that is Active and Logs in
    *******************************************************************************}


    procedure RandomNextPlayer(Active: Boolean);
    var
      LastPlayer: Integer;
    begin
      WriteLn('NextPlayer');
      LastPlayer := CurrentPlayer;
      Players[CurrentPlayer].Active := Active;
      Logout;
      PlayerCurTime := (GetSystemTime div 1000);
      Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
        ((PlayerCurTime - PlayerStartTime) / 60);
      repeat
        if (AllPlayersInactive) then Wait(60000);
        if (PlayersActive = 1) then Break;
        CurrentPlayer := Random(HowManyPlayers);
        Wait(100);
      until (Players[CurrentPlayer].Active) and (LastPlayer <> CurrentPlayer);
      SRL_Logs := SRL_Logs + 1;
      LoginPlayer;
    end;

    {*******************************************************************************
    procedure NextPlayer(Active: Boolean);
    By: Dankness and modified by Ron and by Raymond
    Description: Logs in the next player.
    Boolean: True - Current player is ok. False - Current player is false.
    *******************************************************************************}


    procedure NextPlayer(Active: Boolean);
    begin
      if RandomPlayer then
        RandomNextPlayer(Active)
      else
      begin
        WriteLn('NextPlayer(Active: ' + BoolToStr(Active)+ ');');
        Players[CurrentPlayer].Active := Active;
        Logout;
        PlayerCurTime := (GetSystemTime div 1000);
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
          ((PlayerCurTime - PlayerStartTime) / 60);
        CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
        while Players[CurrentPlayer].Active = False do
        begin
          CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
          if (AllPlayersInactive) then Wait(60000); // Everybody False. Endless Loop.
        end;
        SRL_Logs := SRL_Logs + 1;
        LoginPlayer;
      end;
    end;

    {*******************************************************************************
    procedure CheckUserNicks;
    By: Sumilion / Raymond
    Description: Checks if all nicks are set correct.
    *******************************************************************************}


    procedure CheckUserNicks;
    var
      CorrectString: string;
      i: Integer;
      Wrong : Boolean;
      Str : String;
    begin
      for i := 0 to HowManyPlayers - 1 do
      begin
        if (not(Players[CurrentPlayer].Active)) then Continue;
        Wrong := False;
        if (Players[i].Nick = '') then
        begin
          Wrong := True;
          Str := 'WARNING : Please fill in your nickname.';
        end;
        if (Players[i].Nick <> LowerCase(Players[i].Nick)) then
        begin
          Wrong := True;
          Str := 'WARNING : Please Uncapitalise your nickname.';
        end;
        if (pos(Players[i].Nick, LowerCase(Players[i].Name)) = 1) then
        begin
          Wrong := True;
          Str := 'WARNING : Dont use the first letter in your nick.';
        end;
        if (pos(' ', Players[i].Nick) > 0) then
        begin
          Wrong := True;
          Str := 'WARNING : Dont use spaces in your Nick.';
        end;
        CorrectString := Capitalize(Players[i].Name);
        if not (Pos(LowerCase(Players[i].Nick), CorrectString) > 0) then
        begin
          Wrong := true;
          Str := 'WARNING : Nick does NOT match the name.';
        end;
        if Wrong then
        begin;
          Writeln('--');
          Writeln(Str);
          if (Length(Players[i].Name) > 0) then
            Writeln('Warning occured with player : ' + Players[i].Name);
          Writeln('For more information, visit http://www.villavu.com/forum/showthread.php?t=5410');
        end;
      end;
    end;

    Copy+Paste in your own Login.scar
    Ce ne sont que des gueux


  3. #3
    Join Date
    Nov 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The Above works rep++!!
    Thanks!!!

    ~Kryptic

  4. #4
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    62
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This login no longer works. I'm modifying it ATM to make it work.

  5. #5
    Join Date
    Aug 2008
    Location
    NC
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    (Noob Question) --> How do you copy and paste it into a already existing script, script runs fine, it just does that " hovering" thing at login.

  6. #6
    Join Date
    Nov 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Open Up Scar.
    Go to File>Open
    Scar 3.15(Or W.e You Named it)>InCludes>SRL>SRL>Core>Login.scar

    Open Login.Scar
    Copy+Paste:
    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป Login Routines                              --//
    //-----------------------------------------------------------------//
    // * function  RSReady: Boolean;                      // * by ZephyrsFury
    // * Procedure LoginScreenMusic(State: Variant);      // * by Wizzup?
    // * procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );  // * by ZephyrsFury
    // * procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fl, gt, cs: string);    // * by ZephyrsFury
    // * procedure SetAutoingDefaults;                    // * by ZephyrsFury
    // * procedure Logout;                                // * by Starblaster100 and Raymond
    // * procedure LoginPlayer;                           // * by SRL Developers
    // * procedure RandomNextPlayer(Active: Boolean);     // * by Dankness, Ron and Raymond
    // * procedure NextPlayer(Active: Boolean);           // * by Dankness, Ron and Raymond
    // * procedure CheckUserNicks;                        // * by Sumilion and Raymond
     
    { var SRL_Logs: Integer;
      Description: Variables needed for some login functions. }

    { var RandomPlayer, GraphicsSet: Boolean;
      Description: Variables needed for some login functions. }

    var
      SRL_Logs: Integer;
      RandomPlayer, GraphicsSet: Boolean;
     
    procedure NextPlayer(Active: Boolean); forward;
    procedure RandomNextPlayer(Active: Boolean); forward;
     
    {*******************************************************************************
    function RSReady: Boolean;
    By: ZephyrsFury
    Description: Returns true if we are ready to auto (on loginscreen or logged in).
      Useful for waiting until RS has fully loaded.
    *******************************************************************************}

     
    function RSReady: Boolean;
    begin
      Result := (LoggedIn) or (GetColor(520, 146) = 4038981);
    end;
     
    {*******************************************************************************
    Procedure LoginScreenMusic(State: Variant);
    By: Wizzup?
    Description: Takes Boolean(True, False) or Integer(1..5) as arguments.
      1 or True = Off, 5 or False = Max.
          1   2   3   4   5
        <-o---o---o---o---o->
    *******************************************************************************}

     
    Procedure LoginScreenMusic(State: Variant);
     
    Var
       RealState: Variant;
       x: Extended;
     
    Begin
      if (LoggedIn) then Exit;
      if (CountColor(7750, 346, 356, 416, 369) <> 119) and (GetColor(520, 135) = 4038981) then
      begin
        TypeByte(vk_Escape);
        Wait(100);
      end;
      if (CountColor(7750, 346, 356, 416, 369) <> 119) then Exit;
      Case VarType(State) Of
      11: RealState := (State + 1) * 4;
      3: If InRange(State, 1, 5) Then
           RealState := State - 1;
         Else
           RealState := 0;
      End;
      x := (425.0 - 337.0) * RealState / 4.0 + 339.0;
      If CountColorTolerance(1647966, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
        If CountColorTolerance(991349, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
          Mouse(Round(x), RandomRange(375, 385), 0, 0, True);
     
    End;
     
    {*******************************************************************************
    procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );
    By: ZephyrsFury
    Description: Sets audio options through the login screen.
    Use: Enter the desired Setting for the desired Option. Make option 0 for no change.
      EG. Login_SetAudio(1, 5, 2, NoChange);
     
                            1   2   3   4   5
      Volume, SFX, Area:  <-o---o---o---o---o->
    *******************************************************************************}

     
    procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: TSMSetting);
    var
      II, Tx, Ty, T: Integer;
      Pts: TIntegerArray;
    begin
      if (LoggedIn) then Exit;
      TypeByte(vk_Escape);
      T := GetSystemTime;
      while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
        Wait(100);
      if (CountColor(7750, 346, 373, 416, 386) = 119) then
        MouseBox(334, 362, 426, 371, 1)
      else
        Exit;
      Wait(100);
      Pts := [Volume, SFX, Area];
      for II := 0 to 2 do
      begin
        if (Pts[II] = 0) then Continue;
        if (not(InRange(Pts[II], 0, 5))) then
        begin
          srl_Warn('Login_SetAudio', 'Points must be between 0 and 5', warn_AllVersions);
          Continue;
        end;
        Tx := 337 + Round((425 - 337) * (Pts[II] - 1) / 4);
        Ty := Round(3.5 * II * II + 46.5 * II + 245);
        if (GetColor(Tx, Ty) <> 1121100) then
          Mouse(Tx + 2, Ty - 14, 0, 0, True);
        Wait(50);
      end;
      if (GetColor(337, 389) = 181) and (SMSetting = Stereo) then
        Mouse(421, 385, 10, 10, True)
      else
      if (GetColor(426, 389) = 181) and (SMSetting = Mono) then
        Mouse(332, 385, 10, 10, True);
      Wait(100);
      TypeByte(vk_Escape);
    end;
     
    {*******************************************************************************
    procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
    By: ZephyrsFury
    Description: Sets graphic options in the login screen.
    Use: Enter the desired Setting for the desired Option.
      Leave as 0 for no change of brightness and '' for no change in anything else.
     
      Parameter    Option                Setting
        Brightness   Brightness            1 - 4 (0 for no change)
        vl           Visible Levels        Current / All
        rr           Remove Roofs          Always / Selectively
        gd           Ground Decoration     Off / On
        td           Texture Detail        Low / High
        ia           Idle Animations       Few / Many
        fe           Flickering Effects    Off / On
        gt           Ground Textures       Few / Many
        cs           Chracter Shadows      Off / On
     
                        1   2   3   4
      Brightness:   <---o---o---o---o--->
     
    EG. Login_SetGraphics(2, 'current', '', 'off', 'low', 'few', '', 'few', 'off');
     
    For Autoing:
    Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
    *******************************************************************************}

     
    procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
    var
      Settings, PosSettings, OptionName: TStringArray;
      II, T, W, tCol, x, y, mSpeed: Integer;
      TB: TBox;
      P: TPoint;
    begin
      if (LoggedIn) then Exit;
      Settings := [vl, rr, gd, td, ia, fe, gt, cs];
      PosSettings := ['Current', 'All', 'Always', 'Selectively', 'Off', 'On', 'Low',
        'High', 'Few', 'Many', 'Off', 'On', 'Few', 'Many', 'Off', 'On'];
      OptionName := ['Visible levels', 'Remove roofs', 'Ground decoration', 'Texture detail',
        'Idle animations', 'Flickering effects', 'Ground textures', 'Character shadows'];
      TypeByte(vk_Escape);
      T := GetSystemTime;
      while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
        Wait(100);
      if (CountColor(7750, 346, 373, 416, 386) = 119) then
        MouseBox(321, 338, 443, 346, 1)
      else
        Exit;
      mSpeed := MouseSpeed;
      MouseSpeed := 25;
      Wait(100);
      if (Brightness > 4) then
        srl_Warn('Login_SetGraphics', 'Brightness must be between 0 and 4', warn_AllVersions)
      else
      if (Brightness <> 0) then
      begin
        P := Point(89 + (Brightness - 1) * 21, 266);
        if (GetColor(P.x, P.y) <> 1121100) then
          Mouse(P.x - 3, P.y - 17, 6, 6, True);
      end;
      for II := 0 to 7 do
      begin
        TB.x1 := 67 + 130 * ((II + 1) mod 5);
        TB.y1 := 245 + 60 * ((II + 1) div 5);
        TB.x2 := TB.x1 + 109;
        TB.y2 := TB.y1 + 15;
        if (not(InStrArrEx(Capitalize(Settings[II]), [PosSettings[II * 2], PosSettings[II * 2 + 1]], W))) then
        begin
          srl_Warn('Login_SetGraphics', 'Invalid Setting: ' + Settings[II] + ' for Option: ' + OptionName[II] + '.', warn_AllVersions);
          Continue;
        end;
        tCol := (W mod 2) * 16777088 + 127;
        if (not(FindColor(x, y, tCol, TB.x1, TB.y1, TB.x2, TB.y2))) then
        begin
          Mouse(TB.x1 + 10, TB.y1 + 3, 10, 7, True);
          if (FindColor(x, y, tCol, TB.x1, TB.y2 + 1, TB.x2, TB.y2 + 1 + 51)) then
            Mouse(x, y, 10, 7, True)
          else
            MouseBox(TB.x1 + 10, TB.y1 + 3, TB.x2 - 40, TB.y2 - 3, 1);
        end;
      end;
      Wait(100);
      TypeByte(vk_Escape);
      MouseSpeed := mSpeed;
    end;
     
    {*******************************************************************************
    procedure SetAudioOff;
    By: ZephyrsFury
    Description: Sets the Audio to off (1 for each bar). Works logged in and out.
    *******************************************************************************}

     
    procedure SetAudioOff;
    begin
      if (LoggedIn) then
        SetAudio(1, 1, 1, NoChange)
      else
        Login_SetAudio(1, 1, 1, NoChange);
    end;
     
    {*******************************************************************************
    procedure SetAutoingDefaults;
    By: ZephyrsFury
    Description: Sets the graphic options for best SRL compatibility. Works both logged in and out.
    *******************************************************************************}

     
    procedure SetAutoingDefaults;
    begin
      if (LoggedIn) then
        SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off')
      else
        Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
    end;
     
    {*******************************************************************************
    procedure Logout;
    By: Starblaster100 / Raymond
    Description: Logs you out.
    *******************************************************************************}

     
    function Logout: Boolean;
    var
      c, i: Integer;
    begin
      Result := (not (LoggedIn));
      if Result = True then
        Exit;
      if GameTab(14) = False then
        Exit;
      Wait(200 + Random(100));
      while (LoggedIn) and (c < 10) do
      begin
        Inc(c);
        if(ClickText('here', UpChars, MIX1, MIY1, MIX2, MIY2, True))then
          for i := 0 to 10 do
          begin
            Wait(1000);
            if not(LoggedIn)then
            begin
              Result := True;
              Exit;
            end;
          end;
      end;
    end;
     
    {*******************************************************************************
    procedure LoginPlayer;
    By: SRL Developers
    Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
    *******************************************************************************}

     
    procedure LoginPlayer;
    var
      Mark, Attempts: Integer;
      Actions: TVariantArray;
      RetryLogin: Boolean;
    label
      ProcStart;
    begin
      ActivateClient;
      Wait(100);
     
      if (GetColor(212, 327) = 238301) then    //At Click To Play screen
      begin
        Wait(1000 + Random(3000));
        MouseBox(227, 337, 555, 364, 1);
        MarkTime(Mark);
        while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
          Wait(1000 + Random(1000));
      end;
      if (not(RSReady)) then
      begin
        MarkTime(Mark);
        while (not(RSReady)) do
        begin
          Wait(100);
          if (TimeFromMark(Mark) > 180000) then
          begin
            WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
            TerminateScript;
          end;
        end;
        WriteLn('Welcome to Runescape.');
      end;
     
      LoginScreenMusic(True);
      if (not(GraphicsSet)) then
      begin
        SetAutoingDefaults;
        GraphicsSet := True;
      end;
      ProcStart:
     
      if (not(LoggedIn)) then
      begin
        if (not(Players[CurrentPlayer].Active)) then
        begin
          WriteLn('Player is not Active...');
          NextPlayer(False);
          Exit;
        end;
        Wait(900 + random(60));
     
        //Click 'Log In' on main menu
        while (GetColor(343, 175) <> 7750) do
        begin
          MouseBox(360, 180, 400, 185, 1);
          Wait(100 + Random(100));
        end;
     
        //Type Username
        Mouse(315, 272, 10, 5, True);
        while (CountColor(7750, 311, 269, 452, 284) > 13) do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        for Mark := 0 to 3 do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        Wait(100 + Random(200));
        WriteLn(Capitalize(Players[CurrentPlayer].Name));
        TypeSend(Players[CurrentPlayer].Name);
        Wait(100+random(50));
     
        //Type Password
        Mouse(315, 334, 10, 5, True);
        while (CountColor(7750, 311, 337, 452, 352) > 13) do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        for Mark := 0 to 3 do
        begin
          KeyDown(vk_Back);
          Wait(10 + Random(10));
          KeyUp(vk_Back);
          Wait(50 + Random(50));
        end;
        Wait(100 + Random(200));
        TypeSend(Players[CurrentPlayer].Pass);
        Wait(500 + Random(300));
     
        if (not(FindTextTPA(12509695, 0, 288, 205, 475, 247, 'login', StatChars, Nothing))) then   //If 'enter' from typesend didn't log us in
        begin
          MouseBox(355, 359, 403, 372, 1);  //Click 'login' login screen
          Wait(250 + random(100));
        end;
     
        MarkTime(Mark);
        repeat
          SetLength(Actions, 0);
     
          if (TimeFromMark(Mark) > 60000) then
            Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
          else
          case (CountColor(12509695, 288, 205, 475, 247)) of   //Number of text colour points
            //   Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
            760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
            536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
            711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
            598: Actions := ['Invalid Username \ Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
            917: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
            408: Actions := ['World is full.', 5000, 20, 'Terminate', ''];
            623: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
            555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
            218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
            335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
            512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
            489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
            737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
            //10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
            //11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected'];  // Login server rejected session.
          end;
     
          if (Length(Actions) > 0) then
          begin
            WriteLn(Actions[0]);
            Wait(Actions[1] + Random(100));
            if (Actions[2] <> 0) then
              if (Attempts < Actions[2]) or (Actions[2] = -1) then
              begin
                RetryLogin := True;
                Break;
              end;
            if (Actions[4] <> '') then
              Players[CurrentPlayer].Loc := Actions[4];
            case Actions[3] of
              'NextPlayer': NextPlayer(False);
              'RandomNextPlayer': RandomNextPlayer(True);
              'Terminate': TerminateScript;
            end;
            Exit;
          end;
          Wait(100);
        until(GetColor(212, 327) = 238301);
     
        if (RetryLogin) then
        begin
          RetryLogin := False;
          Inc(Attempts);
          goto ProcStart;
        end;
     
        if (GetColor(212, 327) = 238301) then
        begin
          Wait(1000 + Random(2000));
          MouseBox(227, 337, 555, 364, 1);
        end;
        MarkTime(Mark);
        while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
          Wait(1000 + Random(1000));
      end;
     
      if (LoggedIn) then
      begin
        PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
        if Length(Players[CurrentPlayer].NickTPA) < 2 then
        begin;
          Writeln('Creating the NickTPA.');
          if Players[CurrentPlayer].Nick <> '' then
            Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
          else
          begin;
            Writeln('Nickname isn''t set, taking the username instead..');
            Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
          end;
        end;
        AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
      end;
    end;
     
    {*******************************************************************************
    procedure RandomNextPlayer(Active: Boolean);
    By: Dankness based on WT-Fawki's NextPlayer and modified by Ron and by Raymond
    Description: Picks Random Player that is Active and Logs in
    *******************************************************************************}

     
    procedure RandomNextPlayer(Active: Boolean);
    var
      LastPlayer: Integer;
    begin
      WriteLn('NextPlayer');
      LastPlayer := CurrentPlayer;
      Players[CurrentPlayer].Active := Active;
      Logout;
      PlayerCurTime := (GetSystemTime div 1000);
      Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
        ((PlayerCurTime - PlayerStartTime) / 60);
      repeat
        if (AllPlayersInactive) then Wait(60000);
        if (PlayersActive = 1) then Break;
        CurrentPlayer := Random(HowManyPlayers);
        Wait(100);
      until (Players[CurrentPlayer].Active) and (LastPlayer <> CurrentPlayer);
      SRL_Logs := SRL_Logs + 1;
      LoginPlayer;
    end;
     
    {*******************************************************************************
    procedure NextPlayer(Active: Boolean);
    By: Dankness and modified by Ron and by Raymond
    Description: Logs in the next player.
    Boolean: True - Current player is ok. False - Current player is false.
    *******************************************************************************}

     
    procedure NextPlayer(Active: Boolean);
    begin
      if RandomPlayer then
        RandomNextPlayer(Active)
      else
      begin
        WriteLn('NextPlayer(Active: ' + BoolToStr(Active)+ ');');
        Players[CurrentPlayer].Active := Active;
        Logout;
        PlayerCurTime := (GetSystemTime div 1000);
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
          ((PlayerCurTime - PlayerStartTime) / 60);
        CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
        while Players[CurrentPlayer].Active = False do
        begin
          CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
          if (AllPlayersInactive) then Wait(60000); // Everybody False. Endless Loop.
        end;
        SRL_Logs := SRL_Logs + 1;
        LoginPlayer;
      end;
    end;
     
    {*******************************************************************************
    procedure CheckUserNicks;
    By: Sumilion / Raymond
    Description: Checks if all nicks are set correct.
    *******************************************************************************}

     
    procedure CheckUserNicks;
    var
      CorrectString: string;
      i: Integer;
      Wrong : Boolean;
      Str : String;
    begin
      for i := 0 to HowManyPlayers - 1 do
      begin
        if (not(Players[CurrentPlayer].Active)) then Continue;
        Wrong := False;
        if (Players[i].Nick = '') then
        begin
          Wrong := True;
          Str := 'WARNING : Please fill in your nickname.';
        end;
        if (Players[i].Nick <> LowerCase(Players[i].Nick)) then
        begin
          Wrong := True;
          Str := 'WARNING : Please Uncapitalise your nickname.';
        end;
        if (pos(Players[i].Nick, LowerCase(Players[i].Name)) = 1) then
        begin
          Wrong := True;
          Str := 'WARNING : Dont use the first letter in your nick.';
        end;
        if (pos(' ', Players[i].Nick) > 0) then
        begin
          Wrong := True;
          Str := 'WARNING : Dont use spaces in your Nick.';
        end;
        CorrectString := Capitalize(Players[i].Name);
        if not (Pos(LowerCase(Players[i].Nick), CorrectString) > 0) then
        begin
          Wrong := true;
          Str := 'WARNING : Nick does NOT match the name.';
        end;
        if Wrong then
        begin;
          Writeln('--');
          Writeln(Str);
          if (Length(Players[i].Name) > 0) then
            Writeln('Warning occured with player : ' + Players[i].Name);
          Writeln('For more information, visit http://www.villavu.com/forum/showthread.php?t=5410');
        end;
      end;
    end;

    There.
    Now go to File>Save
    There

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add ranging to chicken killing scripts, or the cow killing scripts
    By canu44 in forum RS3 Outdated / Broken Scripts
    Replies: 0
    Last Post: 12-18-2007, 07:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •