NCDS
2010-07-20 20:13:09
Has now been committed.
I would really appreciate it if people would post their opinions on how this work's vs. the old way.
Please take note this is not yet perfect and still has thing's to be worked on, but I believe at the moment it is somewhat more human like.
{==============================================================================\
| MSI Group Scripting Include |
| Mining.scar |
|==============================================================================|
| For all mining routines. |
| |
| * procedure MSI_WaitWhileMining(); * by NCDS |
| * function MSI_MineRock(); * by NCDS |
| * function MSI_MineInvFull(); * by NCDS & marpis |
\ _____________________________________________________________________________}
{******************************************************************************}
{ Procedure MSI_WaitWhileMining(RockInfo: TMSObject); }
{ By: NCDS }
{ Date: 11 July 2010 }
{ Description: Wait's until an Ore has been mined. }
{******************************************************************************}
Procedure MSI_WaitWhileMining(RockInfo: TMSObject);
var
cts, OldInvCount, t, i, RockColorCount: Integer;
MDAr: T2DPointArray;
Arr: array of TPoint;
SearchBox: TBox;
begin
Flag;
Wait(RandomRange(285, 450));
if InvFull then
Exit;
cts := GetColorToleranceSpeed;
SetToleranceSpeed2Modifiers(RockInfo.Hue, RockInfo.Sat);
t := (GetSystemTime + 60000);
SearchBox := IntToBox(
MSCx - Round(RockInfo.W * 1.75),
MSCy - Round(RockInfo.H * 1.75),
MSCx + Round(RockInfo.W * 1.75),
MSCy + Round(RockInfo.H * 1.75));
OldInvCount := InvCount;
repeat
FindColorsTolerance(Arr, RockInfo.Colors[0], SearchBox.x1,
SearchBox.y1, SearchBox.x2, SearchBox.y2, RockInfo.Tol);
if (Length(Arr) < RockInfo.Accuracy) then
Break;
RockColorCount := Length(Arr);
if (Length(Arr) < Round(RockColorCount * 0.50)) then
Break;
MSI_FindRandoms;
MSI_AntiBan(RandomRange(0, 3000), ANTI_BAN_CHANCE);
if (OldInvCount < InvCount) then
Break;
Wait(RandomRange(100, 300));
until((t > GetSystemTime) or (Length(Arr) < Round(RockColorCount * 0.50)))
SetColorToleranceSpeed(cts);
end;
{******************************************************************************}
{ function MSI_MineRock(Which: TIntegerArray): Boolean; }
{ By: NCDS }
{ Date: 11 July 2010 }
{ Description: Mines Rock }
{******************************************************************************}
function MSI_MineRock(Which: TIntegerArray): Boolean;
var
Rocks: TMSObjectArray;
SearchBox: TBox;
Index: Integer;
begin
Rocks := MSI_GetObjects(Which);
SearchBox := IntToBox(MSx1, MSy1, MSx2, MSy2);
if MSI_FindObjectsIn(Rocks, Index, SearchBox, ClickLeft) then
begin
Result := True;
MSI_WaitWhileMining(Rocks[Index]);
end;
end;
{******************************************************************************}
{ function MSI_MineInvFull(Which: TIntegerArray): Boolean; }
{ By: NCDS & marpis }
{ Date: 11 July 2010 }
{ Description: Mines Rock's until Inventory is full. }
{******************************************************************************}
function MSI_MineInvFull(Which: TIntegerArray): Boolean;
var
t: Integer;
Begin
t := (GetSystemTime + (5 * 60000));
while (not InvFull) and (LoggedIn) and (GetSystemTime < t) do
begin
if MSI_MineRock(Which) then
t := (GetSystemTime + (5 * 60000));
Wait(RandomRange(300, 800));
end;
Result := InvFull;
end;
I would really appreciate it if people would post their opinions on how this work's vs. the old way.
Please take note this is not yet perfect and still has thing's to be worked on, but I believe at the moment it is somewhat more human like.