Having a bit of trouble here. I'm trying to dynamically populate an array of loot objects to make searching for them easier.
Loot record:
Code:
loot = record
name: String; //stores variables that help find loot
overText: TStringArray; //mouseovertext of loot
colours: T2DColorData; //colours of loot
end;
when I initiate the objects of loot record, I set pointer to 0 ( x := 0) then try to add them to the array like this
Code:
dragonBones.init('Dragon Bones', ['ake', 'dragon', 'bones'], [[12698835, 5, [2, [0.93, 0.45, 0.00]]], [12106698, 5, [2, [0.31, 0.64, 0.00]]]]);
lootArray[x] := dragonBones;
inc(x);
then I want to search for them with this:
Code:
for x to high(lootArray) do
begin
if players[currentPlayer].booleans[_DEBUG] then
writeLn('Looking for ',lootArray[x].name, ' ...');
if lootArray[x].find(false) then
begin
if players[currentPlayer].booleans[_DEBUG] then
writeLn('Found ',lootArray[x].name, ' !!');
clickedLoot := true;
break;
end;
end;
I believe I'm not populating the array correctly. Could anyone chime in with some advice? Much appreciated