JuKKa
2008-03-16 12:51:40
Instead of using Getcolor why not use Findcolorstolerance?
to get all colors of the pick, of course this needs then modifying of the findpick procedure. But something like this..
not sure if that works. meerly a example of how it SHOULD be done ;)
to get all colors of the pick, of course this needs then modifying of the findpick procedure. But something like this..
program New;
{.Include SRL/SRL.Scar}
var
HC: tintegerarray;
//EquipPick, Wielding, nopick: boolean;
function InIntArr(Num: Integer; I: TIntegerArray): Boolean;
var
C: Integer;
begin
for C:= 0 to Length(I) - 1 do
if(I[C] = Num)then
begin
Result:= True;
exit;
end;
end;
procedure ShrinkArray(var Arr: TIntegerArray);
var
Used: TIntegerArray;
I, Index: Integer;
begin
SetLength(Used, Length(Arr));
if(InIntArr(0, Arr))then
Inc(Index);
for I:= 0 to Length(Arr) - 1 do
if(not(InIntArr(Arr[i], Used)))then
begin
Used[Index]:= Arr[i];
Inc(Index);
end;
SetLength(Used, Index);
Arr:= Used;
end;
function FindPickHeadColor: Boolean;
var tcolor, Pick, ix, iy, curTab : Integer;
ColorTPA: TPointArray;
begin
Pick := DTMFromString('78DA6334616260B8CD8006189148206D0E54F' +
'391801A2FA09A0704D4B802D55C23A0C60AA8E6060135B6403577' +
'08A8B101AA798C5F0D00537C07EA');
NoPick := True; // Assume we dont have a pickaxe....
curTab := GetCurrentTab;
GameTab(4);
if FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2) then
begin
NoPick := False;
Wielding := False;
EquipPick := Wielding;
end
else
begin
GameTab(5);
if FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2) then
begin
NoPick := False;
Wielding := True;
EquipPick := Wielding;
end;
end;
if not NoPick then // Amazing.
begin
Wait(100 + Random(100));
tcolor := GetColor(ix + 1, iy);
FindColorsTolerance(ColorTPA, tcolor, iX, iY, iX+30, iY+30, 10);
HC := GetColors(ColorTPA);
ShrinkArray(HC); //deletes colors that are the same.
Writeln('picked '+Inttostr(getarraylength(hc))+' colors');
Result := True;
end
else
Result := False;
FreeDTM(Pick);
GameTab(curTab);
end;
begin
SetupSRL;
FindPickHeadColor;
end.not sure if that works. meerly a example of how it SHOULD be done ;)