This is a stripped down script just to demonstrate what I mean.

Code:
program New;
{.include SRL/SRL.scar}

procedure DeclarePlayers;
begin
  HowManyPlayers := 2;
  NumberOfPlayers(HowManyPlayers);
  CurrentPlayer := 0;

  Players[0].Name := '';
  Players[0].Pass := '';
  Players[0].Nick := '';
  Players[0].Active := true;

  Players[1].Name := '';
  Players[1].Pass := '';
  Players[1].Nick := '';
  Players[1].Active := true;
end;

begin
  SetupSRL;
  ActivateClient;
  DeclarePlayers;

  WriteLn('Start: ' + IntToStr(PlayersActive) + ' active.');
  LoginPlayer();
  repeat
    NextPlayer(false);
    WriteLn(IntToStr(PlayersActive) + ' active.');
  until (AllPlayersInactive);
  // Script never ever gets here.
end.
The debug window shows the following:

SRL Compiled in 16 msec
Start: 2 active.
Player1
Creating the NickTPA.
NextPlayer(Active: False);
Player2
Creating the NickTPA.
1 active.
NextPlayer(Active: False);

The script never ever breaks out of the loop, leaving the script still running but doing absolutely nothing. I have to manually stop the script.

What am I missing here?

Edit: Answered my own question. NextPlayer() has an endless loop if AllPlayersInactive is true. They check for that condition inside the loop but don't do anything about it. Sloppy! A very simple change would make it work.

This loop overcomes the flaw in NextPlayer:

Code:
  LoginPlayer;
  repeat
    Players[CurrentPlayer].Active := false;
    if (not AllPlayersInactive) then
      NextPlayer(false);
  until (AllPlayersInactive);
  Logout;