SRL Archive - SRL Suggestions

nextplayer


Le Jingle

2012-07-31 18:47:29

Granted this suggestion isn't a priority, perhaps not even necessary, yet I thought I'd suggest adding in a timeout fail safe in the nextplayer proc. Perhaps I'm misunderstanding the login.simba file too, so if that's the case, ignore / close this suggestion; just trying to offer help ^.^

procedure NextPlayer(Active: Boolean);
var
srl_PlayerIndexFunc: function: Integer;
cP: Integer;
begin
if (RandomPlayer) then
srl_PlayerIndexFunc := @RandomPlayerIndex
else
srl_PlayerIndexFunc := @NextPlayerIndex;

WriteLn('NextPlayer(' + BoolToStr(Active) + ')');
LogOut;
cP := srl_PlayerIndexFunc();
while (cP = -1) do
begin
cP := srl_PlayerIndexFunc();
if (SRL_Procs[srl_InNextPlayerLoop] <> nil) then
SRL_Procs[srl_InNextPlayerLoop]();
Wait(5000);//Endless loop
end;

SwitchToPlayer(cP, Active);
end;
to include a failsafe?

procedure NextPlayer(Active: Boolean);
var
srl_PlayerIndexFunc: function: Integer;
cP, t: Integer;
begin
if (RandomPlayer) then
srl_PlayerIndexFunc := @RandomPlayerIndex
else
srl_PlayerIndexFunc := @NextPlayerIndex;

WriteLn('NextPlayer(' + BoolToStr(Active) + ')');
LogOut;
cP := srl_PlayerIndexFunc();
while (cP = -1) do
begin
cP := srl_PlayerIndexFunc();
if (SRL_Procs[srl_InNextPlayerLoop] <> nil) then
SRL_Procs[srl_InNextPlayerLoop]();
Wait(5000);
if (timefrommark(t)>120000) then
srl_Warn('NextPlayer', 'Failure in switching to the next player', warn_AllVersions);
end;

SwitchToPlayer(cP, Active);
end;

cheers,
Lj

Kyle Undefined

2012-08-01 10:32:04

There's a post on how to control this in your script, I'll try and find it for you when I get home :)