mika
2011-02-16 17:14:15
The problem is after MineMith cant find the colors(BTW iw ill change to findobject instead of find color later) of the rock to mine it walks to the coal, but after not find the color it walks again and again until it does it no more than 8 times(thats why i have the # of wait so it wont try mining more rocks then there are) I want the script to only walk to coal once not several times & after walking the to mine the coal(i already have procedure ready for mining coal)
BTW this isn't the entire script only the part im stuck on.
BTW this isn't the entire script only the part im stuck on.
procedure MineMith;
var
x, y : Integer;
begin
if not LoggedIn then Exit;
if FindColorTolerance(x, y, 7425099, MSX1, MSY1, MSX2, MSY2, 10) then // If the color (7425099) is found, the coordinates of where it was found is stored in the variables (x, y).
Mouse(x, y, 5, 5, True) // This moves and clicks the mouse to x, y; 4, 4 is the randomness on x, y
else
begin
Wait(1000); // Remember 1000ms = 1s
MakeCompass('n');
Writeln('First FindColor failed, trying second...');
if FindColorTolerance(x, y, 7819343, MSX1, MSY1, MSX2, MSY2, 10) then
Mouse(x, y, 4, 2, True) // This moves AND left clicks the mouse with randomness 4, 4; 'True' = Left click; 'False' = Right click
else
begin
Wait(2000);
Writeln('Second FindColor failed, trying third...');
if FindColorTolerance(x, y, 6505026, MSX1, MSY1, MSX2, MSY2, 15) then
Mouse(x, y, 4, 4, True)
else
begin
Wait(2000);
Writeln('Third FindColor failed, trying forth...');
if FindColorTolerance(x, y, 6636611, MSX1, MSY1, MSX2, MSY2, 15) then
Mouse(x, y, 4, 4, True)
else
begin
Wait(1560);
WalkToCoal;
Writeln('Forth FindColors failed, logging out');
Writeln('walk to coal'); // This is pretty straight forward, it logs your player out
end;
end;
end;
end;
end; // There are so many 'end's because each begin has to have an end, otherwise you will get an "Identifier expected..." error
function InvyFulBankIt: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;
if (InvFull) then
if FindObjCustom(x, y, ['eposit', 'ank'], [5791845, 6121068], 5) then//Notice how I used "[]".
begin
Writeln('Found deposit box!');
Mouse(x, y, 56, 6, True);//MMouse and uptext check isn't needed becaue it's already built into FindObjCustom, understand?
Result := True;//Returns true of the copper ore was clicked.
end else
//Find deposit box procedure
end;
procedure RepeatMineMith;
var
numberOfWaits: Integer;
begin // Although 'repeat' acts like a 'begin', 'begin' is still needed here to signal the start of the procedure
repeat
Wait(10195);
MineMith;
Inc(numberOfWaits); // The Inc() command simply increases the var numberOfWaits by 1
Writeln('We have mined ' + IntToStr(numberOfWaits) + ' times');
until(InvFull) or (numberOfWaits = 8);
Wait(1095 + random(400));
InvyFulBankIt;
end;
begin
ClearDebug;
SetupSRL;
DeclarePlayers; // Calls the procedure, you can't forget this!
LoginPlayer; // You want your player to login, right?
RepeatMineMith;
end.
The red flag shows where the character is walking.