Naum
2009-10-06 19:54:27
The current FindPickHeadColor in SRL wasn't working, (just for jokes, try removing the 'p' from findpickheadcolor).
Anyways, I had a look at the current function, and it's still as flawless as always. The only things which needed to be updated were the DTM and the Cord addition/subtraction.
Tested with ALL pickaxes:
EDIT: To test, I used this crudely constructed script:
Basically cross-references what is found and stored as the colors by finding the colors then storing them to an array, then debuging it.
Anyways, I had a look at the current function, and it's still as flawless as always. The only things which needed to be updated were the DTM and the Cord addition/subtraction.
Tested with ALL pickaxes:
{*******************************************************************************
function FindPickHeadColor: Boolean;
By: WT-Fakawi fixed by NaumanAkhlaQ
Description: Finds PickHead colors. Returns hc1, 2, 3, 4 & 5 for PickHead finding
of False when No Pick is in either GameTab(tab_Inv) or GameTab(5).
Sets Global variable NoPick.
*******************************************************************************}
function FindPickHeadColor: Boolean;
var Pick, ix, iy, curTab : Integer;
begin
Pick := DTMFromString('78DA63FCC2C4C0F09C910115302291409A899' +
'981E1310135FF8830870368CE4B026A78816A5EE3570300F6B206' +
'B0');
NoPick := True; // Assume we dont have a pickaxe....
curTab := GetCurrentTab;
GameTab(tab_Inv);
if FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2) then
begin
NoPick := False;
Wielding := False;
EquipPick := Wielding;
end
else
begin
GameTab(tab_Equip);
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));
mmouse(ix, iy, 0, 0);
Hc1 := GetColor(ix + 1, iy);
Hc2 := GetColor(ix + 2, iy - 1);
Hc3 := GetColor(ix + 6, iy - 1);
Hc4 := GetColor(ix + 12, iy + 1);
Hc5 := GetColor(ix + 16, iy);
Writeln('PickColors = ['+inttostr(hc1)+', '+inttostr(hc2)+', '
+inttostr(hc3)+', ' +inttostr(hc4)+', ' +inttostr(hc5)+'];');
Result := True;
end
else
Result := False;
FreeDTM(Pick);
GameTab(curTab);
end;EDIT: To test, I used this crudely constructed script:
program New;
{.Include SRL/SRL.Scar}
{.Include SRL/SRL/Misc/Debug.Scar}
Var x, y, hc1, hc2, hc3, hc4, hc5 : Integer;
nopick, wielding, equippick : boolean;
pickcolors : tintegerarray;
tpa, tpa2 : tpointarray;
function FindPickHeadColor: Boolean;
var Pick, ix, iy, curTab : Integer;
begin
Pick := DTMFromString('78DA63FCC2C4C0F09C910115302291409A899' +
'981E1310135FF8830870368CE4B026A78816A5EE3570300F6B206' +
'B0');
NoPick := True; // Assume we dont have a pickaxe....
curTab := GetCurrentTab;
GameTab(tab_Inv);
if FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2) then
begin
NoPick := False;
Wielding := False;
EquipPick := Wielding;
end
else
begin
GameTab(tab_Equip);
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));
mmouse(ix, iy, 0, 0);
Hc1 := GetColor(ix + 1, iy);
Hc2 := GetColor(ix + 2, iy - 1);
Hc3 := GetColor(ix + 6, iy - 1);
Hc4 := GetColor(ix + 12, iy + 1);
Hc5 := GetColor(ix + 16, iy);
Writeln('PickColors = ['+inttostr(hc1)+', '+inttostr(hc2)+', '
+inttostr(hc3)+', ' +inttostr(hc4)+', ' +inttostr(hc5)+'];');
Result := True;
end
else
Result := False;
FreeDTM(Pick);
GameTab(curTab);
end;
Begin
SetupSRL;
findpickheadcolor;
pickcolors := [hc1, hc2, hc3, hc4, hc5];
for x := 0 to high(pickcolors) do
begin
Findcolorstolerance(TPA, pickcolors[x], MIX1, MIY1, MIX2, MIY2, 0);
TPA2 := CombineTPA(tpa, tpa2);
end;
debugtpa(tpa2, '');
End.Basically cross-references what is found and stored as the colors by finding the colors then storing them to an array, then debuging it.