SRL Archive - Bugs

GoundItems Bug


Bad Boy JH

2010-10-12 21:24:54

as soon as I realised ground items was updated, i checked it out, however there is an error in this code. This will only get the items in the top right (I think - when values are greatest), because each loop it replaces the T_GIA.

function GetItemsNear(AreaFromMe: Integer): TGroundItemArray;
var
I, II: Integer;
MyPos: TPoint;
t_GIA: TGroundItemArray;
begin
If Not LoggedIn then
Exit;

MyPos := GetMyPos;

For I:=0 to AreaFromMe*2 do
For II:=0 to AreaFromMe*2 do
t_GIA := GetItemsAt(Tile(MyPos.X-AreaFromMe+II, MyPos.Y-AreaFromMe+I));

Result := t_GIA;
end;

pyroryan

2010-10-12 21:58:17

TGroundItemArrays add onto each other. Hence the reason why you should always clear the array via "TGroundItemArrayVariable := []" before using it again in your script.

Bad Boy JH

2010-10-12 22:51:05

wow, thats rather random..why is that?

Naike

2010-10-14 05:11:05

I've noticed it doing that..
I couldn't figure if it was a bug, or a feature..

However, it works on all tiles. (at least it should? test it?)