Hey litoris,
I took a look through your script, and I've got a few suggestions for you. Note that they're mostly for shortening code and increasing efficiency; what you've got so far already works great.
First off, you've got 4 functions (FindRock, FindDoorAtMine, FindDoorAtBank, OpenDBox) using the same basic structure. You should try using a case statement and combining them all. Also, take a look at the comments I put in:
Simba Code:
function FindObject(Which: String): Boolean; //Mine as well make it a function
var
TPA1, TPA2, RTPA: TPointArray;
Color, Tol: TIntegerArray;
Dist, nCTS, cts, i: Integer;
ATPA: T2DPointArray;
Option, Uptext: String;
begin
case Lowercase(Which) of
'rock':
begin
nCTS := 2;
Color := [3557498, 3829892];
Tol := [5, 5];
Dist := 10;
Uptext := 'ron ore';
Option := 'ine';
end;
//'bank door':
//'mine door':
//'dbox':
end;
Result := False;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(nCTS);
FindColorsTolerance(TPA1, Color[0], MSX1, MSY1, MSX2, MSY2, Tol[0]);
RAaSTPAEx(TPA1,3,3);
FindColorsTolerance(TPA2, Color[1], MSX1, MSY1, MSX2, MSY2, Tol[1]);
RAaSTPAEx(TPA2,3,3);
RTPA := AND_TPA(TPA1,TPA2,0,Dist);
if Length(RTPA) = 0 then
begin
writeln('Didn''t find '+Which+' colors.');
ColorToleranceSpeed(cts);
Exit;
end;
ColorToleranceSpeed(cts);
ATPA := SplitTPAEx(RTPA, 15, 15);
if (Length(ATPA) > 0) then
begin
SortATPASize(ATPA, true); //Not sure if using both is necessary/efficient
SortATPAFrom(ATPA, Point(MSCX, MSCY));
end else
Exit;
SMART_ClearCanvas;
Proggy;
for i:= 0 to high(ATPA) do
begin
Antirandoms;
SMART_DebugTPA(False, ATPA[i]);
MMouse(MiddleTPA(ATPA[i]).x, MiddleTPA(ATPA[i]).y, 5, 5);
if (WaitUptext(Uptext, 300 + Random(100))) then
begin
ClickMouse2(mouse_right);
if WaitOption(Option, 600) then //Should add an if..then here so it will continue if option isn't found
begin
Result := True;
Exit;
end;
end;
end;
end;
That way you can do this with your mining loop:
Simba Code:
procedure Minemine; //clicks rock and waits
var
z : Integer;
begin
if FindObject('rock') then
begin
MarkTime(z);
repeat
Antiban;
Antirandoms;
Proggy; //proggy while waiting
Wait(600);
until (not (Mining)) or (TimeFromMark(z) > (2400 + Random(300)))
end;
end;
I think that's it. You've got a great script here, I hope to see more from you in the future