SRL Archive - Help

Find DTM until true not working?


rj

2012-12-14 20:19:10

In my script, a IronMiner, I make it mine rocks, the procedure is this:

Procedure FindRock;
var
tmpCTS, l, r,X,Y:Integer;
IronTPA:TPointArray;
SmokeTPA:TPointArray;
begin
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.17, 0.17);
If FindColorsTolerance(SmokeTPA, 7110803, 11, 27, 522, 360, 4) then
begin
AntiSmoke;
end;
begin
MouseSpeed:=17;
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.18,0.45);
if FindColorsTolerance(IronTPA, 2569557, 11, 27, 522, 360, 3) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(IronTPA)
wait(randomrange(60, 200));
mmouse(IronTPA[r].x, IronTPA[r].y, 2, 2);
wait(randomrange(150, 300));
clickmouse2(mouse_left);
wait(randomrange(2500, 3500));
begin
repeat
FindRock;
until (FindDTM(IronOre, x, y, 685, 444, 738, 489)=true);
end;
end;
end;
DropIt;
end;

And instead of just making that repeat 28 times like I might have when i was a n00b or trying to find a color in the last slot like when I was a n00b I added this:

begin
repeat
FindRock;
until (FindDTM(IronOre, x, y, 685, 444, 738, 489)=true);
end;
end;
end;
DropIt;
end;

In a attempt to make it drop the ore when ever it finds the ironore dtm in the last slot. But the script is not going to the dropit procedure it just keeps trying to mine iron rocks! did i put "DropIt;" in the wrong place?

P1ng

2012-12-14 20:26:28

you have like a thousand ends in your mainloop there that you don't need?

But perhaps your script is not finding the DTM, try adding some tolerance to each of your point on your DTM? or use a central point with some tolerance and then the rest along the black outline of the ore

Slashed

2012-12-14 20:28:15

There is something that does exactly what you want which is:

function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
(Checks if the dtm is in the inventory. Returns the item’s coordinates.)


Or simply, without going through that trouble, use :

procedure DropItem(i: Integer);
Drops item at given position (1-28)


NOTE: Quotes taken from : http://docs.villavu.com/srl-5/inventory.html#

Also, that syntax is really messy, you're calling FindRock within itself. Delete those ends on the main loop, put them before the mainloop begin..

rj

2012-12-14 20:29:50

Using it for a pserver so most SRL shortcuts are out of the queston, ill try editing the DTM

rj

2012-12-14 20:34:44

EDIT: NVM did not find the problem still does not work with a different DTM

rj

2012-12-14 20:53:41

fixed.

P1ng

2012-12-15 00:34:29

What was the issue in the end?

rj

2012-12-15 09:53:30

From: P1ng
What was the issue in the end?


Not sure, I just made it check for the DTM at the start of the clickrock procedure