NCDS
2010-09-08 18:54:01
Current FindPickHeadColor;
After my updates:
Also, MSI uses one record for each type of rock. What is the purpose for SRL having so many? Is there a reason why/is anyone opposed having a single record made to work for each type of rock?
{*******************************************************************************
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: Integer;
curTab: Byte;
begin
Result := False;
if (not LoggedIn) then exit;
Pick := DTMFromString('78DA63FCC2C4C0F09C910115302291409A899' +
'981E1310135FF8830870368CE4B026A78816A5EE3570300F6B206' +
'B0');
NoPick := True;
curTab := GetCurrentTab;
GameTab(tab_Inv);
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := False;
EquipPick := False;
end else
begin
GameTab(tab_Equip);
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := True;
EquipPick := False;
end;
end;
if (not NoPick) then
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);
srl_Warn('FindPickHeadColor', 'PickColors = [' + IntToStr(hc1) + ', ' + IntToStr(hc2) + ', '
+ IntToStr(hc3) + ', ' + IntToStr(hc4) + ', ' + IntToStr(hc5)+'];', warn_Debug);
Result := True;
end;
FreeDTM(Pick);
GameTab(curTab);
end;
After my updates:
function FindPickHeadColor: Boolean;
var
Pick, ix, iy, i, curTab : Integer;
begin
Result := False;
if (not LoggedIn) then exit;
Pick := DTMFromString('78DA63646065604861628001462076894E63F' +
'80F65FF0702461EA09A74841A086082AB87D040350904D47C6241' +
'B10BA73959F8D50000AE40092D');
i := 0;
NoPick := True;
curTab := GetCurrentTab;
repeat
case GetCurrentTab of
tab_Inv:
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := False;
EquipPick := False;
Break;
end else
begin
GameTab(tab_Equip);
Inc(i);
end;
tab_Equip:
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := True;
EquipPick := False;
Break;
end else
Inc(i);
else
Gametab(tab_Inv);
end;
until(not (NoPick)) or (i > 1);
if (not NoPick) then
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);
Hc4 := GetColor(ix, iy - 1);
Hc5 := GetColor(ix + 3, iy - 1);
srl_Warn('FindPickHeadColor', 'PickColors = [' + IntToStr(hc1) + ', ' + IntToStr(hc2) + ', '
+ IntToStr(hc3) + ', ' + IntToStr(hc4) + ', ' + IntToStr(hc5)+'];', warn_Debug);
Result := True;
end;
FreeDTM(Pick);
GameTab(curTab);
end;
Tested and work's: (Yes, all the points are on the PickHead.)
Compiled succesfully in 593 ms.
SRL Compiled in 16 msec
** Warning in FindPickHeadColor: PickColors = [7892048, 11574902, 7103571, 11903865, 8024414];**
Successfully executed.
What I changed:- Updated the DTM
- Changed Hc[1..5] to work accordingly with the new DTM
- Updated the tab handling to be more human-like.
Also, MSI uses one record for each type of rock. What is the purpose for SRL having so many? Is there a reason why/is anyone opposed having a single record made to work for each type of rock?