YoHoJo
2011-03-11 16:08:48
How would I easily total
Need it for a progress report.
players[X].integers[P_AMOUNT] for all of my players?Need it for a progress report.
2011-03-11 16:08:48
players[X].integers[P_AMOUNT] for all of my players?2011-03-11 16:31:32
2011-03-11 17:20:00
2011-03-12 03:56:43
2011-03-12 04:11:43
From: EvilChicken!
Even better, use IncEx. ;)
2011-03-12 04:25:22
From: YoHoJo
How so?
2011-03-12 08:15:33
From: EvilChicken!Inc(I) is faster than I := I + 1; but IncEx(I, 1) is slower than both I := I + 1; and Inc()
It was more meant jokingly, although I must admit preferring Inc and IncEx over the alternatives because I think they're slightly easier on the eyes. Some even say they're faster, but the difference is insignificant for real usage.
var
t, I, C : Integer;
begin
t := GetSystemTime;
for I := 1 to $ffff do
Inc(C);
WriteLn('Inc: ' + IntToStr(GetSystemTime-t));
t := GetSystemTime;
for I := 1 to $ffff do
C := C + 1;
WriteLn('C+1: ' + IntToStr(GetSystemTime-t));
t := GetSystemTime;
for I := 1 to $ffff do
C := C + 50;
WriteLn('C+50: ' + IntToStr(GetSystemTime-t));
t := GetSystemTime;
for I := 1 to $ffff do
IncEx(C, 1);
WriteLn('IncEx1: ' + IntToStr(GetSystemTime-t));
t := GetSystemTime;
for I := 1 to $ffff do
IncEx(C, 50);
WriteLn('IncEx50: ' + IntToStr(GetSystemTime-t));
end.Compiled succesfully in 31 ms.
Inc: 172
C+1: 187
C+50: 187
IncEx1: 359
IncEx50: 358
Successfully executed.
2011-03-12 08:27:51
var
I, total: Integer;
begin
for I := 0 to GetArrayLength(Players) - 1 do
total := total + players[I].integers[blah];
writeln(inttostr(total));
end;2011-03-12 08:32:05
From: Home
var
I, total: Integer;
begin
for I := 0 to GetArrayLength(Players) - 1 do
total := total + players[I].integers[blah];
writeln(inttostr(total));
end;
~Home
2011-03-12 10:55:22
2011-03-12 10:55:45
From: EvilChicken!<3 :)
That's exactly what Zy aswered with, but wrapped in SIMBA tags..?
2011-03-12 13:56:21
From: EvilChicken!
That's exactly what Zy aswered with, but wrapped in SIMBA tags..?
2011-03-12 22:56:42
From: YoHoJoLol'd :p
I like Homes better, it's standardized and has Simba tags