SRL Archive - SRL Bugs

Endless Loop in NextPlayer


TRiLeZ

2010-02-20 19:11:36


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

WriteLn('NextPlayer');
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;

What does the loop even do?
This has froze scripts a lot of times for me… it needs to be fixed.

Gu3st...

2010-02-20 19:13:07

It's meant to be like that. When all your players .active is false it goes into an endless loop

Nava2

2010-02-20 19:16:19

think a global var to break it would be useful.

Also if there isn't already a procedural pointer in there.

Wanted

2010-02-20 19:20:23

This has been brought up a lot before, denied/ignored every time. I just use

if (not (AllPlayersInActive)) then

before LoginPlayer and NextPlayer ect..

noidea

2010-02-20 20:19:51

It used to annoy the hell out of me >.> Why is it an endless loop!?!?

Gu3st...

2010-02-21 03:24:20

From: noidea
It used to annoy the hell out of me >.> Why is it an endless loop!?!?


From: Zyt3x
It's meant to be like that. When all your players .active is false it goes into an endless loop


-.-

Sir R. M8gic1an

2010-02-21 04:03:22



//start of mainloop:
SRL_Procs[srl_InNextPlayerLoop] := @ScriptTerminate;


//then this will make some sense
if (SRL_Procs[srl_InNextPlayerLoop] <> nil) then
SRL_Procs[srl_InNextPlayerLoop]();



~RM

Nava2

2010-02-21 09:34:58

RM that would make it terminate everytime a player changes..

Sir R. M8gic1an

2010-02-21 11:01:36

From: Nava2
RM that would make it terminate everytime a player changes..


Nope;

srl_OnNextPlayer = 5; //While the players are logged out and before CurrentPlayer changes.

srl_InNextPlayerLoop = 10; //During the infinite loop in NextPlayer when all players are inactive.

http://villavu.com/repositories/srl-opendev/SRL/core/Globals.scar

~RM