Log in

View Full Version : Mining script not working properly



sickle
06-17-2012, 06:47 PM
The procedure mines mithril. I want to make it mine mithril while mithril can be found in view, and then if not found move on to the next procedure. Usually it mines one mithril, and although there are more mithril it will just move on to the next procedure.

I think it's something to do with while-do or repeat-until or for-do, but changing things around didn't help.

Thank you in advance for your expert help!

:fiery:



procedure MithFinder;
var
x, y, z, T, d : Integer;
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin

while (d<100) do
inc(d);

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04,0.3);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9200996, MSX1, MSY1, MSX2, MSY2, 12);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);

For I := 0 to High(ATPA) do

begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);

if WaitUptext('ine',900) then
begin
ClickMouse2(1);
MarkTime(T);
Writeln('Minig Mithril')
wait(random(1200));


repeat
inc(Z);
writeln('waiting for mithril rock ('+(inttostr(z))+')');
wait(1000+random(250));
until(z>29) or (TimeFromMark(T)>14000+Random(450));

end;
end;
end;

Recursive
06-17-2012, 07:14 PM
In your repeat function, call the mining procedure again and repeat until there is no mithril to be found.

putonajonny
06-17-2012, 07:34 PM
Have a read through the comments:Function MithFinder : Boolean; //Make this a function so you know if it worked
var
x, y, z, T, d, CTS, I, H, Count : Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin

while (d<100) do
inc(d);
//why not just:
d := 101;

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04,0.3);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9200996, MSX1, MSY1, MSX2, MSY2, 12);
ColorToleranceSpeed(CTS);
TPAtoATPAExWrap(TPA, 15, 15, ATPA);
Count := InvCount;

H := high(ATPA); //This saves checking it every time (every time)
For i := 0 to H do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 5, 5); //Increase the randomness
if WaitUptext('ine',900) then
begin
Result := True;
ClickMouse2(mouse_Left);//Use mouse_Left and mouse_Right they read better
MarkTime(T);
Writeln('Minig Mithril')
wait(random(1200));
repeat //Your logic up to here has been great, but what are you doing here?
inc(Z);
writeln('waiting for mithril rock ('+(inttostr(z))+')');
wait(1000+random(250));
until((z>29) or (TimeFromMark(T)>14000+Random(450))); //You don't need a counter and a time marker, choose one
while(Count = InvCount)do //I suggest you replace that repeat function with this...
begin
if(TimeFromMark(T)>14000+Random(450))then
break;
wait(200+Random(1000));
end;
end;
end;
end;

sickle
06-17-2012, 08:48 PM
I tried yours putonajonny, but it does exactly the same thing the previous version did, which is mining 1-2 mithril and then simply moving on to the next procedure without mining all mithril in view. Maybe it's something wrong outside my procedure?

LIL HOMIE
06-17-2012, 11:22 PM
can sumone help me when i use my simba bot and go to fishing at barbarian fishing spot it doesnt fish or bank...... just walks around tries to find it
sumone plz help

P1ng
06-18-2012, 01:43 AM
Post up the whole code of your script, it doesn't appear to be so much a problem with your mithril finding function as it does with your main loop.

sickle
06-18-2012, 01:52 AM
Thanks every1 for many help! I solved it by separating it into mithril finding function and mithril mining procedure.