SRL Archive - OSR Help

Destroy an item while dropping


FiLow

2012-02-20 07:49:48

Hey,

I'm making a Mahongany/Teak PowerChopper in Hardwood grove, but the point is, sometimes you will get a special log (Mahogany and Teak) and you have to destroy it, because you can't drop it. Is there any way to destroy that special log and just drop the normal Teak/Mahogany logs? The special logs have stripes on it, so they look different in color, but not in shape. I hope you understand what I mean and know a solution.

Thanks in advance.

Sin

2012-02-20 08:07:46

Use a bitmap.

FiLow

2012-02-20 08:12:29

And how am I supposed to do that? I'm new at this. I know a few things about DTM and thats all.

EDIT: I'm watching a tutorial how to do this, thanks S1n.

Ashaman88

2012-02-20 08:53:07

Depends on how you are doing the dropping procedure. If you are just going through each space and dropping whatever item is there, you can just put an if function for options exist 'stroy' and chose that option if it's available

FiLow

2012-02-20 09:00:26

Could someone tell me whats wrong with this code?

Var x, y, bitmap : Integer;

Begin
bitmap := BitmapFromString(15, 11, 'meJw9kVtLAlEUhX+SKJVN5FMPgh' +
'KVzuRlxksiIoOE4psoioqSaCRGIlGIMXTB8Cf03lv/qA8WDnwP5+y' +
'19jr7nGNPvKNECeyJ50zfc7OPY6sC+fsvKDxsTzLuqV27WeyK828q' +
'vopEERVYCCNVJYGc7N2btqg4/UZUETbLeNKj9fXgJRC1mrs/nOrVP' +
'KiZ8Uakhq9W/znZXV61H4PxLE4CqdN+eFlEJQQDmL1VovPEqHBWac' +
'UaY2YgCil07qASgoEcQKKIRDshpPEIEec2WuvrIJAT6PJtHM2E7vp' +
'H8xMCJJMv2MrG0WRyWaM0YEHx4CIPihJcQTb//TFzQXv/NcoRbPWA' +
'+gKugLn++cuWU4AQ5SgKD/Aa+o5//FPdkA==');

If FindBitmap(Bitmap, x, y) Then
Begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop');
wait(1200 + random(1000));

End;
End;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
FreeBitmap(Bitmap); // :)
End.

FiLow

2012-02-20 09:02:23

Ashaman, I got this drop procedure:

procedure SmartDrop;
var
logdtm, x, y: integer;
begin
if not (LoggedIn) or not (Players[CurrentPlayer].Active) then
NextPlayer(false);
Writeln('using Dtm (smart way) slower though but more accurate');
logdtm := DTMFromString('78DA63CC63626078C880029A536D18FE03694' + '620FE0F048C054035EF18D000231209A463816A9E135093015473' + '87809A3222D45413B60B0046720E26');
gametab(4);
repeat
if finddtm(logdtm, x, y, 550, 203, 731, 464) then
begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop');
wait(1200 + random(1000));
{ case LowerCase(Players[CurrentPlayer].Strings[1]) of
'tree': ReportVars[4] := ReportVars[4] + 28;
'oak': ReportVars[5] := ReportVars[5] + 28;
'willow': ReportVars[6] := ReportVars[6] + 28;
'all': ReportVars[7] := ReportVars[7] + 28; }
//end;
end;
end;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
freedtm(logdtm);
end;

Yes, I didn't make it by myself. But what should I add then?

Home

2012-02-20 09:08:33

That procedure will drop Items by DTM (Currently Log)

~Home

FiLow

2012-02-20 09:09:55

Yes, and I have to add something that it will destroy the special logs.

VillaVuFTW

2012-02-20 09:21:30

This is how I would do it

procedure SmartDrop;
var
logdtm, x, y: integer;
begin
if not (LoggedIn) or not (Players[CurrentPlayer].Active) then
NextPlayer(false);
Writeln('using Dtm (smart way) slower though but more accurate');
logdtm := DTMFromString('78DA63CC63626078C880029A536D18FE03694' + '620FE0F048C054035EF18D000231209A463816A9E135093015473' + '87809A3222D45413B60B0046720E26');
gametab(4);
repeat
if finddtm(logdtm, x, y, 550, 203, 731, 464) then
begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop')
else
waitoption('Destroy');
MMouse(x of the destroy thing, y of the destroy thing, randomx, randomy);
Mouse(0, 0, true);
wait(1200 + random(1000));
{ case LowerCase(Players[CurrentPlayer].Strings[1]) of
'tree': ReportVars[4] := ReportVars[4] + 28;
'oak': ReportVars[5] := ReportVars[5] + 28;
'willow': ReportVars[6] := ReportVars[6] + 28;
'all': ReportVars[7] := ReportVars[7] + 28; }
//end;
end;
end;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
freedtm(logdtm);
end;

Be mindful, that I'm typing this straight from my head.

You can use the DTM of the logs if you want.. But I would make the DTM of the logs, the same as the Specials, like the same colors.. If you want.. You can even use ACA, ot ATPAs(if you know how to)

Correct me if I am wrong.. WaitOption already does the Right Click..

Thread to ACA (Which is quite accurate way of finding things)

http://villavu.com/forum/showthread.php?t=26944&highlight=AutoColorAid

FiLow

2012-02-20 09:24:53

Ok thanks, i'm gonna see if it works.

FiLow

2012-02-20 09:29:14

It gives an error at the line ''else'' and I don't know what you mean with a DTM with the same colors. Also when you click destroy, you will get a confirmation screen.

FiLow

2012-02-20 09:41:59

It keep giving me an error at the line else, this is what I did:

procedure SmartDrop;
var
logdtm, x, y: integer;
begin
if not (LoggedIn) or not (Players[CurrentPlayer].Active) then
NextPlayer(false);
Writeln('using Dtm (smart way) slower though but more accurate');
logdtm := DTMFromString('78DA63CC63626078C880029A536D18FE03694' + '620FE0F048C054035EF18D000231209A463816A9E135093015473' + '87809A3222D45413B60B0046720E26');
gametab(4);
repeat
if finddtm(logdtm, x, y, 550, 203, 731, 464) then
begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop')
else
waitoption('Destroy');
MMouse(374, 400);
Mouse(0, 0, true);
wait(1200 + random(1000));

end;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
freedtm(logdtm);
end;

VillaVuFTW

2012-02-20 10:05:12

procedure SmartDrop;
var
logdtm, x, y: integer;
begin
if not (LoggedIn) or not (Players[CurrentPlayer].Active) then
NextPlayer(false);
Writeln('using Dtm (smart way) slower though but more accurate');
logdtm := DTMFromString('78DA63CC63626078C880029A536D18FE03694' + '620FE0F048C054035EF18D000231209A463816A9E135093015473' + '87809A3222D45413B60B0046720E26');
gametab(4);
repeat
if finddtm(logdtm, x, y, 550, 203, 731, 464) then
begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop')
else
waitoption('Destroy');
MMouse(374, 400);
Mouse(0, 0, true);
wait(1200 + random(1000));

end;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
freedtm(logdtm);
end;
I meant you can make a DTM for the regular logs, and it will pick up the Special aswell, if you get the same color like if Log1 (Regular) is 1523083, find to see if that is a color on the Log2(Special) so it will pick up the special..

But if you want, you can USE ACA for the Log and SpecialLog

As for the ELSE Error.. I think you have to add a Begin End;

Like This.. Try this Code
procedure SmartDrop;
var
logdtm, x, y: integer;
begin
if not (LoggedIn) or not (Players[CurrentPlayer].Active) then
NextPlayer(false);
Writeln('using Dtm (smart way) slower though but more accurate');
logdtm := DTMFromString('78DA63CC63626078C880029A536D18FE03694' + '620FE0F048C054035EF18D000231209A463816A9E135093015473' + '87809A3222D45413B60B0046720E26');
gametab(4);
repeat
if finddtm(logdtm, x, y, 550, 203, 731, 464) then
begin
Mouse(x, y, 3, 3, false);
begin
wait(random(400) + 100);
chooseoption('Drop')
else
Begin
waitoption('Destroy');
MMouse(374, 400);
Mouse(0, 0, true);
wait(1200 + random(1000));
end;
end;
until (not (finddtm(logdtm, x, y, 550, 203, 731, 464)));
freedtm(logdtm);
end;

FiLow

2012-02-20 10:12:27

I still get the same error.

And for that ACA, I just don't get it to work.

VillaVuFTW

2012-02-20 10:14:47

PM ME your script please.. I'll check it out

FiLow

2012-02-20 10:15:17

Will do.