Results 1 to 5 of 5

Thread: main loop help

  1. #1
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default main loop help

    My main problem is, how to alternate a script between 2 players, whilst using the 6 hour fix too. Here's an example of what I'm trying to accomplish.
    Simba Code:
    begin
      SRL_SixHourFix := True;
      Smart_FixSpeed := True;
      SetupSRL;
      ObjDTM_Setup;
      SRL_Procs[SRL_OnFindRandom] := @Little_Logout;//simple proc to logout b/c we shouldn't get random events
      script_setup;
        repeat
          repeat
            if not LoggedIn then
              smooth_login;
            if rs_update then
              break_until_pass; //nifty on weekly updates

            dowork;
            dowork1;
            Wait(20+random(10));
            doprog;           //6hr, 15min
          until(gettimerunning>=22500000) or (not loggedin);
          NextPlayer(True); {*???}
        until((count = need_number));
    end.
    So, if I start the script with player 0, then would nextplayer(true) keep switching from 0 to 1, then 1 to 0, etc.? Or would I need to somehow use SwitchToPlayer, or something more modified of SwitchToPlayer, or something else? Any advice/input/feedback very welcomed!

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

    Default

    Quote Originally Posted by Le Jingle View Post
    My main problem is, how to alternate a script between 2 players, whilst using the 6 hour fix too. Here's an example of what I'm trying to accomplish.
    Simba Code:
    begin
      SRL_SixHourFix := True;
      Smart_FixSpeed := True;
      SetupSRL;
      ObjDTM_Setup;
      SRL_Procs[SRL_OnFindRandom] := @Little_Logout;//simple proc to logout b/c we shouldn't get random events
      script_setup;
        repeat
          repeat
            if not LoggedIn then
              smooth_login;
            if rs_update then
              break_until_pass; //nifty on weekly updates

            dowork;
            dowork1;
            Wait(20+random(10));
            doprog;           //6hr, 15min
          until(gettimerunning>=22500000) or (not loggedin);
          NextPlayer(True); {*???}
        until((count = need_number));
    end.
    So, if I start the script with player 0, then would nextplayer(true) keep switching from 0 to 1, then 1 to 0, etc.? Or would I need to somehow use SwitchToPlayer, or something more modified of SwitchToPlayer, or something else? Any advice/input/feedback very welcomed!
    Here is some code snippets of what I use see if they help you

    Simba Code:
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;//set higher if you plan on using more
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;//what player to start with

      with Players[0] do
      begin
        Name   := ''; //Character Name
        Pass   := ''; //Character Pass
        Pin    := ''; //Pin for bank
        Active := true;
      end;

      {with Players[1] do
      begin
        Name   := ''; //Character Name
        Pass   := ''; //Character Pass
        Pin    := ''; //Pin for bank
        Active := true;
      end;

      with Players[2] do
      begin
        Name   := ''; //Character Name
        Pass   := ''; //Character Pass
        Pin    := ''; //Pin for bank
        Active := true;
      end;

      with Players[3] do
      begin
        Name   := ''; //Character Name
        Pass   := ''; //Character Pass
        Pin    := ''; //Pin for bank
        Active := true;
      end; }
    //honestly if you need more than 4 accounts Ctrl + c and Ctrl + v   =P
    end;
    //main loop starts here
      DeclarePlayers;

      repeat
        LoginPlayer;
        Wait(800);

        repeat

        until(not(loggedin));
        NextPlayer(Players[CurrentPlayer].Active = False);//because you ARE logged out
      until AllPlayersInactive;//multiplayer check

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    @getdropped69, I suppose I could just enter my accounts in as different players, in which will alternate them, but isn't there an easier / shorter way to achieve that?

  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    I've written two choices here.. Either redirect the logout procedure to the wrapper.. OR just use the nested loops. You do not need both.

    Simba Code:
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 2;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name        := 'PName';
        Pass        := 'PWord';
        Pin         := 'Pin';
        Active      := True;
      end;

      with Players[1] do
      begin
        Name        := 'PName2';
        Pass        := 'PWord2';
        Pin         := 'Pin2';
        Active      := True;
      end;
    end;

    Procedure WrapperExample;
    begin
      Players[CurrentPlayer].Active := False;
      LoginPlayer;  //Attempt to login the player to get the RsUpdate screen. SixHourFix will get kicked in.
    end;

    begin
      {$IFDEF SMART}
        SRL_SixHourFix := True;
        Smart_FixSpeed := True;
      {$ENDIF}

      DeclarePlayers;
      SetupSRL;

      //SRL_Procs[SRL_OnRSLogOut] := @WrapperExample;  Uncomment to redirect.

      repeat
        repeat
          //Do whatever in here.. main loop bleh..

        until(Not Players[CurrentPlayer].Active);
      until(AllPlayersInactive);
    end.
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Ah thanks for the example, that beats writing out a long list of players to use for only 2 accounts -.- And also, thanks for the general help to the community too, I think it's fair to add this 2nd thanks in here

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
  •