SRL Archive - OSR Help

Detecting if all players are not active


cathering_

2007-10-11 18:15:06

I saw a function once that detected if all the players were not active, i forgot how to do it. (And I will not be accepting simple ways out of it) (eg just using howmanyplayers>= 8 then if players[8] blah blah…) can anyone show me how?

Dan Cardin

2007-10-11 18:20:05

why does it matter? the script stops if all the players are false ne way

cathering_

2007-10-11 18:26:18

Not if its looping, and at the end it will print a final progress report….

Bramble

2007-10-11 18:26:22

i did this just as a fail safe
for i := 0 to howmanyplayers-1 do
if players[i].active=true then
activity:=activity+1;
until (activity=0);

Dan Cardin

2007-10-11 18:30:06

not if you do a while loop then use brambles and make a var thats true if all are false then
while flase= true do 
everything else

cathering_

2007-10-11 19:02:59

Ill try it out, Thanks.

Method

2007-10-11 19:07:05

You can use a function I made if you don't want to use the other suggestions posted earlier.

function AllPlayersAreFalse: Boolean;
var
i, FalseCount: Integer;
begin
for i := 0 to HowManyPlayers - 1 do
begin
if(Players[i].Active) then
begin
Result := False;
Break;
end else
FalseCount := FalseCount + 1;
end;
if(FalseCount = HowManyPlayers) then
Result := True;
end;

cathering_

2007-10-11 19:38:13

To late =P i just made one =P, ive finished the script now. ^^ althougth its not been tested

Santa_Clause

2007-10-11 19:49:47

What the? Why are all your functions so long?

Here:

function AllPlayersInactive : Boolean;
var
I : integer;
begin
for I := 0 to HowManyPlayers - 1 do
if Players[I].Active then
Exit;
Result := True;
end;