almost
2009-01-09 23:46:56
Edit:
Added in a check for if you can wield your pick or not (My army all has 40+ attack so I didn't consider this at first)
It sets a boolean based on if your Attack level is 40 or higher (Doesn't have to open your stats tab either)
This will work for any type of pickaxe, without setting anything before calling this function.
I've tested it loads of times at weird angles, things covering up the pick head, all types of picks, pick head being far off screen, and nothing stumps it.
There are two places you might have to edit to fit your script.
What to do if your pick is broken and the ID of the ore you are mining.
Added in a check for if you can wield your pick or not (My army all has 40+ attack so I didn't consider this at first)
It sets a boolean based on if your Attack level is 40 or higher (Doesn't have to open your stats tab either)
This will work for any type of pickaxe, without setting anything before calling this function.
I've tested it loads of times at weird angles, things covering up the pick head, all types of picks, pick head being far off screen, and nothing stumps it.
There are two places you might have to edit to fit your script.
What to do if your pick is broken and the ID of the ore you are mining.
function ClickInvID(ID: integer; Left: boolean): boolean;
var
ItemSlots: TIntegerArray;
begin
if not InventoryContains(ID, ItemSlots) then
begin
Result:= false;
Exit;
end;
MouseItem(ItemSlots[0], Left);
Result:= true;
end;
function FindPick: boolean;
var
Items: array of TGroundItem;
PickHeadTile: TPoint;
c, c2, x, y: integer;
WieldPick: boolean;
CharStats: TMe;
begin
for c:= 1 to 5 do
begin
if not FindGroundItems(Items, [480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491], 50) then
begin
{your pick is broken}
{Put whatever your script needs to do for broken picks here}
end;
WieldPick:= (CharStats.Levels[0] >= 40);
if WieldPick then
for c:= 1 to 10 do
begin
if (InvCount > 26) then
begin
ClickInvID(454 {this id is for coal, change if you are mining another ore}, false);
Wait(800 + Random(500));
ChooseOption('rop');
Wait(800 + Random(500));
end;
end else
for c:= 1 to 10 do
begin
if (InvCount > 27) then
begin
ClickInvID(454 {this id is for coal, change if you are mining another ore}, false);
Wait(800 + Random(500));
ChooseOption('rop');
Wait(800 + Random(500));
end;
end;
if not (TileOnMS(Items[0].Tile, 0)) then
TileWalk(Items[0].Tile, 5, 0, 1, 1);
PickHeadTile:= TileToMS(Items[0].Tile, 0);
for c2:= 1 to 20 do
begin
MMouse(PickHeadTile.x - 5, PickHeadTile.y - 5, 10, 10);
Wait(500 + Random(500));
if (Pos('ick', RS_GetUpText) > 0) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
AlmFlag(0);
Result:= true;
Break;
end;
end;
if Result then
Break;
end;
Result:= false;
if WieldPick then
begin
GameTab(5);
Mouse(579, 303, 5, 5, true);
Wait(100 + Random(500));
end;
GameTab(4);
Wait(500 + Random(500));
if ClickInvID(489, true) then
begin
Wait(500 + Random(500));
if ClickInvID(467, true) then
begin
Wait(2000 + Random(500));
for c2:= 1265 to 1276 do
if ClickInvID(c2, true) then
begin
WriteLn('Attached pick head!');
Result:= true;
{if your script keeps track of picks fixed
Inc(PicksFixed); }
Exit;
end;
end;
end;
end;