SRL Archive - SRL Bugs

PlayerWorked


TomTuff

2011-02-05 15:32:11

Playerworked has been returning odd amounts of times for me (too high). The script I'm working on has been running for about 15 minutes, but not according to PlayerWorked…


| Worked: 14 hr 1 min 42 sec

The code that outputs that:

writeln('| Worked: ' + MsToTime(PlayerWorked(i), time_Abbrev));

**BANNED The Man

2011-02-05 15:38:02

could you use: TimeRunning?

-Boom

TomTuff

2011-02-05 15:40:13

From: Dynamite
could you use: TimeRunning?

-Boom


I could, but that could be erroneous for 2 reasons: breaks and multiplayer.

**BANNED The Man

2011-02-05 16:14:26

Ok, so I think I was stupid and started work on a MultiplayerTiming function… should I continue or quit?
Here is what I have so far:

procedure MultiplayerTime(StartPlayerTime, EndPlayerTime:integer);
begin
case StartPlayerTime of
0: Player0Begin := MarkTime;
1: Player1Begin := MarkTime;
2: Player2Begin := MarkTime;
3: Player3Begin := MarkTime;
4: Player4Begin := MarkTime;
5: Player5Begin := MarkTime;
6: Player6Begin := MarkTime;
7: Player7Begin := MarkTime;
8: Player8Begin := MarkTime;
9: Player9Begin := MarkTime;
10: Player10Begin := MarkTime;
11: Player11Begin := MarkTime;
12: Player12Begin := MarkTime;
end;
case EndPlayerTime of
0: begin
Player0Total := (Player0Total + TimeFromMark(Player0Begin));
Player0Begin := 0;
end;
1: begin
Player1Total := (Player1Total + TimeFromMark(Player1Begin));
Player1Begin := 0;
end;
2: begin
Player2Total := (Player2Total + TimeFromMark(Player2Begin));
Player2Begin := 0;
end;
3: begin
Player3Total := (Player3Total + TimeFromMark(Player3Begin));
Player3Begin := 0;
end;
4: begin
Player4Total := (Player4Total + TimeFromMark(Player4Begin));
Player4Begin := 0;
end;
5: begin
Player5Total := (Player5Total + TimeFromMark(Player5Begin));
Player5Begin := 0;
end;
6: begin
Player6Total := (Player6Total + TimeFromMark(Player6Begin));
Player6Begin := 0;
end;
7: begin
Player7Total := (Player7Total + TimeFromMark(Player7Begin));
Player7Begin := 0;
end;
8: begin
Player8Total := (Player8Total + TimeFromMark(Player8Begin));
Player8Begin := 0;
end;
9: begin
Player9Total := (Player9Total + TimeFromMark(Player9Begin));
Player9Begin := 0;
end;
10: begin
Player10Total := (Player10Total + TimeFromMark(Player10Begin));
Player10Begin := 0;
end;
11: begin
Player11Total := (Player11Total + TimeFromMark(Player11Begin));
Player11Begin := 0;
end;
12: begin
Player12Total := (Player12Total + TimeFromMark(Player12Begin));
Player12Begin := 0;
end;
end;


procedure StartTiming;
begin
MultiplayerTime(Players[CurrentPlayer], 2000);
end;

I think I am over complicating it…

-Boom

Troll

2011-02-05 16:19:48

From: Dynamite
Ok, so I think I was stupid and started work on a MultiplayerTiming function… should I continue or quit?
Here is what I have so far:

procedure MultiplayerTime(StartPlayerTime, EndPlayerTime:integer);
begin
case StartPlayerTime of
0: Player0Begin := MarkTime;
1: Player1Begin := MarkTime;
2: Player2Begin := MarkTime;
3: Player3Begin := MarkTime;
4: Player4Begin := MarkTime;
5: Player5Begin := MarkTime;
6: Player6Begin := MarkTime;
7: Player7Begin := MarkTime;
8: Player8Begin := MarkTime;
9: Player9Begin := MarkTime;
10: Player10Begin := MarkTime;
11: Player11Begin := MarkTime;
12: Player12Begin := MarkTime;
end;
case EndPlayerTime of
0: begin
Player0Total := (Player0Total + TimeFromMark(Player0Begin));
Player0Begin := 0;
end;
1: begin
Player1Total := (Player1Total + TimeFromMark(Player1Begin));
Player1Begin := 0;
end;
2: begin
Player2Total := (Player2Total + TimeFromMark(Player2Begin));
Player2Begin := 0;
end;
3: begin
Player3Total := (Player3Total + TimeFromMark(Player3Begin));
Player3Begin := 0;
end;
4: begin
Player4Total := (Player4Total + TimeFromMark(Player4Begin));
Player4Begin := 0;
end;
5: begin
Player5Total := (Player5Total + TimeFromMark(Player5Begin));
Player5Begin := 0;
end;
6: begin
Player6Total := (Player6Total + TimeFromMark(Player6Begin));
Player6Begin := 0;
end;
7: begin
Player7Total := (Player7Total + TimeFromMark(Player7Begin));
Player7Begin := 0;
end;
8: begin
Player8Total := (Player8Total + TimeFromMark(Player8Begin));
Player8Begin := 0;
end;
9: begin
Player9Total := (Player9Total + TimeFromMark(Player9Begin));
Player9Begin := 0;
end;
10: begin
Player10Total := (Player10Total + TimeFromMark(Player10Begin));
Player10Begin := 0;
end;
11: begin
Player11Total := (Player11Total + TimeFromMark(Player11Begin));
Player11Begin := 0;
end;
12: begin
Player12Total := (Player12Total + TimeFromMark(Player12Begin));
Player12Begin := 0;
end;
end;


procedure StartTiming;
begin
MultiplayerTime(Players[CurrentPlayer], 2000);
end;

I think I am over complicating it…

-Boom


Cant you just do
For I:= 0 to 12 Do
Begin
End


???

TomTuff

2011-02-05 16:24:01

From: Troll Man
Cant you just do
For I:= 0 to 12 Do
Begin
End


???


and instead of making hundreds of new global variables use Players.Worked.

**BANNED The Man

2011-02-05 16:42:57

From: TomTuff
and instead of making hundreds of new global variables use Players.Worked.


But you are saying PlayerWorked isn't working…
And yes, I am tired I could have just done for loop

TomTuff

2011-02-05 16:44:05

lol no, "Worked" is an aspect of TUser.

**BANNED The Man

2011-02-05 16:45:07

From: TomTuff
lol no, "Worked" is an aspect of TUser.


Yes and PlayerWorked:
result := Players[player].Worked;

TomTuff

2011-02-05 16:47:50

From: Dynamite
Yes and PlayerWorked:
result := Players[player].Worked;


Read on and you'll see that if the player is the current player, it adds the amount of time worked. It builds on itself, it just uses Worked to store the variable.

Yago

2011-04-11 20:35:49

Bump.

Has this been fixed because sometimes it still happens to me… PlayerWorked returns hign numbers and players.worked sometimes returns negatives.

TomTuff

2011-04-11 20:40:51

From: Yago
Bump.

Has this been fixed because sometimes it still happens to me… PlayerWorked returns hign numbers and players.worked sometimes returns negatives.


I have the issue. PlayerWorked uses a global var "PlayerStartTime" which is set in LoginPlayer.

Simple fix:


if not(LoggedIn) then
LoginPlayer
else
PlayerStartTime := GetSystemTime;

Yago

2011-04-11 20:43:18

So this happens if loginplayer fails?

We add this to our login procedure in our scripts right?

Brandon

2011-04-11 21:03:58

If Im correct last time I reported (either this or XP bug), OP told me to use a different method and dont question it ;) And Floor66 helped me resolve it :S
The same thing also happens for xp… U get negative numbers sometimes even when your logged in.. Playersworked also messes up like that when not logged in and when your logged in it gives the wrong values..

Yago

2011-04-11 21:04:49

How did you fix? Where do you place that code?

TomTuff

2011-04-11 21:19:23

I already said… it occurs when you start the script logged in already. instead of just having LoginPlayer, have

From: TomTuff

if not(LoggedIn) then
LoginPlayer
else
PlayerStartTime := GetSystemTime;

Yago

2011-04-11 21:23:48

Oh ok. I get it now. thanks.