SRL Archive - MSI Suggestions

New Mining.simba


NCDS

2010-07-20 20:13:09

Has now been committed.


{==============================================================================\
| 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.

i luffs yeww

2010-07-20 20:55:15

Why five minute wait time AND LoggedIn? If it's more than five minutes, it will log out anyway. :p Seems a bit unnecessary to me (MSI_MineInvFull). Can't read anything more complex than that right now. :) Great job!

NCDS

2010-07-20 21:06:46

From: i luffs yeww
Why five minute wait time AND LoggedIn? If it's more than five minutes, it will log out anyway. :p Seems a bit unnecessary to me (MSI_MineInvFull). Can't read anything more complex than that right now. :) Great job!


It just add's 5 minutes to the time it is aloud to run, this way if it get's no ore's within 5 minutes, it will log out assuming that there is a problem ;)

i luffs yeww

2010-07-20 21:25:59

What I was trying to say that it's a little pointless I think. :p Like.. waiting five minutes will result in the same thing as LoggedIn (if it waits, they'll both be true). I dunno. :3

Juanita's chips.. jesus. So good. ^^

NCDS

2010-07-20 21:30:02

From: i luffs yeww
What I was trying to say that it's a little pointless I think. :p Like.. waiting five minutes will result in the same thing as LoggedIn (if it waits, they'll both be true). I dunno. :3

Juanita's chips.. jesus. So good. ^^


Not if it gets caught in a loop where it's executing AntiBan or something though.

i luffs yeww

2010-07-20 21:35:30

I'll trust you on this one. :p

marpis

2010-07-21 06:15:11

Nice :)

Hint:
SearchBox := IntToBox(MSx1, MSy1, MSx2, MSy2);

you can just use MSBox.

NCDS

2010-07-21 12:00:42

From: marpis
Nice :)

Hint:
SearchBox := IntToBox(MSx1, MSy1, MSx2, MSy2);

you can just use MSBox.


Ok, thanks I'll change that. :)