(0001152)
|
fri
|
2011-09-21 12:00
(edited on: 2011-09-21 12:11) |
|
I tested it on Windows, but I think it would be the same on Linux. Servers that ran previous versions of my script acted weird because of this issue; I think those ran on Linux.
Anyway, I made a script and noticed that it not only returns different result on 2.6.5 and 2.7.0, but on both servers AlphaScore returns 0, even though I set it to 1 point.
Script (first two screenshots):
function OnPlayerCommand(id: byte; text: string): boolean;
var i: byte;
begin
if (lowercase(text) = '/test') then begin
command('/pause');
command('/setteam1 ' + inttostr(id));
for i := 1 to 5 do command('/addbot2 Boogie Man');
setteamscore(1, 1);
setteamscore(2, 8);
writeconsole(id, 'Alpha Players: ' + inttostr(AlphaPlayers), $FFFFAAAA);
writeconsole(id, 'Bravo Players: ' + inttostr(BravoPlayers), $FFAAAAFF);
writeconsole(id, 'Alpha Score: ' + inttostr(AlphaScore), $FFAAFFAA);
writeconsole(id, 'Bravo Score: ' + inttostr(BravoScore), $FFAAFFAA);
writeconsole(id, '-----------------------', $FF000000);
writeconsole(id, 'AP - BP + AS - BS = ' + inttostr(AlphaPlayers-BravoPlayers+AlphaScore-BravoScore), $FFFFFFFF);
end;
result := false;
end;
Script (the third screenshot):
function OnPlayerCommand(id: byte; text: string): boolean;
var i: byte;
intAlphaPlayers, intAlphaScore: integer;
begin
if (lowercase(text) = '/test') then begin
command('/pause');
command('/setteam1 ' + inttostr(id));
for i := 1 to 5 do command('/addbot2 Boogie Man');
setteamscore(1, 1);
setteamscore(2, 8);
writeconsole(id, 'Alpha Players: ' + inttostr(AlphaPlayers), $FFFFAAAA);
writeconsole(id, 'Bravo Players: ' + inttostr(BravoPlayers), $FFAAAAFF);
writeconsole(id, 'Alpha Score: ' + inttostr(AlphaScore), $FFAAFFAA);
writeconsole(id, 'Bravo Score: ' + inttostr(BravoScore), $FFAAFFAA);
writeconsole(id, '-----------------------', $FF000000);
writeconsole(id, 'AP - BP + AS - BS = ' + inttostr(AlphaPlayers-BravoPlayers+AlphaScore-BravoScore), $FFFFFFFF);
intAlphaPlayers := AlphaPlayers;
intAlphaScore := AlphaScore;
writeconsole(id, 'intAP - BP + intAS - BS = ' + inttostr(intAlphaPlayers-BravoPlayers+intAlphaScore-BravoScore), $FFFFFFFF);
writeconsole(id, 'AP - BP + intAS - BS = ' + inttostr(AlphaPlayers-BravoPlayers+intAlphaScore-BravoScore), $FFFFFFFF);
writeconsole(id, 'intAP - BP + AS - BS = ' + inttostr(intAlphaPlayers-BravoPlayers+AlphaScore-BravoScore), $FFFFFFFF);
end;
result := false;
end;
Screenshots:
http://tehoko.info/paste/2011-09/server265.jpg [^] (correct result)
http://tehoko.info/paste/2011-09/server270.jpg [^] (incorrect result)
http://tehoko.info/paste/2011-09/server270comp.png [^] (comparison with all combinations of intAlphaPlayers and intAlphaScore)
There are 10 bots, because SetTeamScore is rather slow and I had to reuse the /test command to make it register the new score values - so five bots were added twice. As you can see, there's a difference in result and AlphaScore returns 0, while it shouldn't. Also, only the first one needs to be converted to integer. Looks like the first used variable defines the type of the result.
|
|